Skip to content

more generic integration of markdown-js and tomarkdown #9

@millette

Description

@millette

First, thanks for a nice addon, just what I was looking for, mostly :-)

I've been playing with it a little bit and finally understood it's hardcoded to support both markdown-js and toMarkdown JavaScript libraries. I saw how I could hook into onShow, etc. and was partly able to get things done, but!

In my case, I'm storing markdown in the db (couchdb, not that it matters) and when displaying a page, the markdown gets converted on the server to html and that's what's shown to the user.

When I edit, I don't want (or don't trust) toMarkdown, I much prefer to ask my db for the actual markdown. A quick ajax request gets that done, and I'm able to setContent with the markdown I just got. So good so far, but I feel it would be better if I could hook myself inplace of toMarkdown to make that ajax request under the hood. One thing is toMarkdown expects html content whereas my ajax call will take the document ID.

Finally, I'd like to use marked instead of markdown-js for the preview on the client side, but I can imagine cases where this would be another ajax call. I think it would be a nice option to be able to specify both functions we want to use as callbacks, instead of having those 2 hardcoded.

I'm ready to work on this if it's clear enough and if you find the idea interesting.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions