upflow icon indicating copy to clipboard operation
upflow copied to clipboard

Custom converter on initialization

Open NV opened this issue 15 years ago • 2 comments

upflow.attach(
    document.getElementById("canvas"),
    document.getElementById("content"),
    my_converter);

I want to set up my own converter on initialization.

Now I can do it by upflow.showdown = my_converter, but it will override converter for all instances of upflow. This is not good in case which is contain two different converters in one page (for example, Markdown and Textile).

I've tried patch upflow by myself with no luck. It was harder than I thought.

NV avatar Jan 03 '10 22:01 NV

I'm afraid that's probably going to be slightly more difficult than that. Even if the library was changed to make filters a property of canvas, rather than a global, there are other places where upflow assumes that it's working with markdown. Such as upflow.parseToTokens and upflow.roundTrip.

That said, I think it could be done with some refactoring. Do you have a javascript implementation of textile at hand?

troelskn avatar Jan 03 '10 22:01 troelskn

http://jrm.cc/extras/live-textile-preview.php

NV avatar Jan 03 '10 22:01 NV