Skip to content

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

Open
emagnier wants to merge 1 commit into
refactory-id:masterfrom
emagnier:md-adapter
Open

Make the markdown lib dependencies as a default and editable option#47
emagnier wants to merge 1 commit into
refactory-id:masterfrom
emagnier:md-adapter

Conversation

@emagnier

@emagnier emagnier commented Mar 9, 2014

Copy link
Copy Markdown
Contributor

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

toopay commented Mar 12, 2014

Copy link
Copy Markdown
Member

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
Copy Markdown
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
Copy Markdown
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

toopay commented Jan 15, 2015

Copy link
Copy Markdown
Member

@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
Copy Markdown
Contributor Author

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

@toopay

toopay commented Jan 15, 2015

Copy link
Copy Markdown
Member

@emagnier Great.

@mkvl77 mkvl77 left a comment

Copy link
Copy Markdown

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