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

Make the markdown lib dependencies as a default and editable option #47

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

emagnier
Copy link
Contributor

@emagnier emagnier commented Mar 9, 2014

This adds 2 additional options, that give the possibility to use any markdown library we want.

E.g.:

$("#target-editor").markdown({
  htmlToMarkdown: function(html) {
    return toMarkdown(html);
  },
  markdownToHtml: function(md) {
    return markdown.toHTML(md);
  }
})

By default these 2 options still use markdown-js or marked (so it's backward compatible with previous editor versions).

It should also fix #9.

@toopay
Copy link
Member

toopay commented Mar 12, 2014

I have used bootstrap markdown with custom parser. This changes will make the editor library less extendable for non-markdown parser which undesired (from my perspective). Thanks for the effort thought.

@toopay toopay closed this Mar 12, 2014
@emagnier
Copy link
Contributor Author

I'm not sure to understand well your point here.
It keeps exactly the same behaviour as before (use of markdown-js and marked as fallback, and to-markdown), so by default it will not change anything.

I just moved the call of these hardcoded dependencies to the default options. So if needed, it just give an additional way to redefine our custom dependencies without have to define a markdown library in a global scope. I find it more elegant and makes possible for exemple to use easily two editors with different parsers in the same page.

I think it's going in the same direction that discussion: #9.
But I'm surely missing something :)

@emagnier
Copy link
Contributor Author

@toopay if you have time, could you reconsider my PR or give me some details how I can set a custom parser on a specific markdown-editor? And without have to modify directly bootstrap-markdown?
Thanks for your help.

@toopay
Copy link
Member

toopay commented Jan 15, 2015

@emagnier There are many changes already happens, so if you still interested to work on this patch, we will need to clean and rebase it with current head.

My previous point was, while this editor is intentionally build for markdown, but current design still allow this editor to be extended with any parser they wish. To keep this generic behaviour, lets not use markdownToHtml or htmlToMarkdown. Since both proposed methods are basically a hook, lets keep the api as generic as possible. Make sense?

@emagnier
Copy link
Contributor Author

@toopay Sure thing! I may have some time to look at it during the weekend.

@toopay
Copy link
Member

toopay commented Jan 15, 2015

@emagnier Great.

Copy link

@mkvl77 mkvl77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

``

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

Successfully merging this pull request may close these issues.

more generic integration of markdown-js and tomarkdown
3 participants