Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

more generic integration of markdown-js and tomarkdown #9

Open
millette opened this issue Jul 14, 2013 · 3 comments · May be fixed by #47
Open

more generic integration of markdown-js and tomarkdown #9

millette opened this issue Jul 14, 2013 · 3 comments · May be fixed by #47

Comments

@millette
Copy link

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.

@toopay
Copy link
Member

toopay commented Jul 14, 2013

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.

@millette 👍

Go for it. I'll happy to merge those refactored patch...

@millette
Copy link
Author

Great! I had to postpone this a little bit but I hope to get it done within a week or two. If anyone else wants to tackle this first, be my guest :-)

@emagnier
Copy link
Contributor

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants