tui.editor icon indicating copy to clipboard operation
tui.editor copied to clipboard

Restrict markdown to a specific specification (eg. CommonMark)

Open ViggoV opened this issue 8 years ago • 5 comments

Version

1.0.3

Test Environment

MacOS, any browser

Current Behavior

No way to manage markdown specification or missing documentation

Expected Behavior

This is not a bug report, but a feature request (given that it isn't hidden somewhere already). You write in your readme and on your page that you "respect" both CommonMark and GFM, but there doesn't seem to be a way to reliably restrict the editor to use a specific specification. Since the purpose of using a markdown editor (at least in our case) is to store the output and render it elsewhere, we really need to be able to control the format precisely.

Case in point: I need to store the Markdown in the database and later render it through Ruby on Rails. Since there are subtle differences between md implementations I have no way to ensure that the final output matches what the user sees while editing. Therefore I need to restrict tui-editor to render strict CommonMark and so find a similarly strict Ruby renderer..

ViggoV avatar Feb 19 '18 14:02 ViggoV

I agree and It's worth to have.

This editor is currently laying on markdown-it(with GFM). and no more effort to strict the mode. The strict mode option will involve several tasks. It'll be a long way.

I also have a plan in mind that organizing the TOAST UI Editor Only features and syntaxes(merged cell table, UML, chart, etc). maybe we can name it kind of "TOAST Flavored Markdown" or whatever.

So let us start discussing it here. I'll start with listing the tasks later.

kyuwoo-choi avatar Feb 25 '18 13:02 kyuwoo-choi

With the current ecosystem of 50,000 different markdown specifications, that would most likely be very helpful, and at least be able to configure the editor to state which format (or which 'extensions') for markdown to use, would allow for greater interoperability with what is used in the back-end.

If approached right, this could then also make it more doable for developers to add their own functionality to the rendering of custom markdown extensions.

xaroth avatar Mar 28 '18 09:03 xaroth

It is an interesting problem. If the purpose is interoperability with other markdown capable software, the solution can only be strict adherence to a commonly used format. This, however, requires the other software to be as strict about the spec as TUI editor is.

In any case, I think it sounds reasonable to go by a minimal/vanilla spec and make it extensible. Since the developer probably has to render the output it makes most sense to start from a vanilla format and then implement rendering as you add modules.

I don't know how strict these specs really are, but it seems to me that there might be a little too much wiggle room to make sure different renderers look exactly the same. Perhaps it would be better work towards an extensible TUI standard that is easy to implement elsewhere, say, a ruby-gem..

ViggoV avatar Mar 28 '18 13:03 ViggoV

The same method is used by python, where the markdown module has several extensions that you can toggle on to add upon the base conversion for the extra functionality: https://python-markdown.github.io/extensions/

This has led to a large array of third party extensions as well: https://github.com/Python-Markdown/markdown/wiki/Third-Party-Extensions

While this may make it a bit more difficult from a user and core perspective (users would have to specify exactly what addons they'd want, and the core part needs to be refactored into an extendable manner), in terms of usability, that approach would most definitely work.

xaroth avatar Mar 28 '18 15:03 xaroth

Yah I just realized that merging cells in the table isnt standard GFM. I'm gonna remove that feature in our use via css, since we want to stay strict only GFM only

Would be nice to just specify a supported markdown format only

gregroyal avatar Jun 11 '19 15:06 gregroyal