You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
I tried to fix that one here. My PR was particularly useful because it avoid to hard-code new dependencies, and give us more flexibility to use any dependency we need. And of course it was still backward compatible: it keeps exactly the same behaviour as before (use of markdown-js and marked as fallback, and to-markdown).
@toopay could you give me additional details on what I could improve on my PR? Thanks!
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.
The text was updated successfully, but these errors were encountered: