runarberg / markdown-it-math

Markdown-it plugin to include math in your document
MIT License
40 stars 18 forks source link

Made inline delimiter length customizable #3

Closed adam-p closed 9 years ago

adam-p commented 9 years ago

I want to be able to use your plugin in Markdown Here when I switch the renderer to markdown-it, but MDH's math support uses $ rather than $$ as the inline delimiter. So... this PR makes the inline delimiter length customizable.

I would prefer to use your plugin rather than maintain a fork with this one change, but I understand if you don't want to merge this -- it's not very exciting and doesn't do much for you.

adam-p commented 9 years ago

I'm going to close this PR because:

  1. Using a global variable to store the setting is the wrong approach. If the same package instance were used with multiple renderer instances, the setting would get overwritten.
  2. I'm going to have to make much more extensive changes to work with Markdown Here. For example, the enclosing <math> tag doesn't work, since MDH renders to a simple <img>.
runarberg commented 9 years ago

I was thinking it would be a nice feature to be able to customize the opening and closing delimiters. So for example you could write \(...\) for inline and \[...\] for block level math. Also I was thinking of getting rid of the enclosing <math> tags and allow people to use what ever renderer they feel like.

When I wrote this I was really opinionated that people should start using MathML, since it is an established standard by now. But I guess I wasn't thinking to much outside the browser environment, where polyfills aren't as easy (like in an e-mail).

runarberg commented 9 years ago

I created issues #4 and #5 to address this.

adam-p commented 9 years ago

Cool. There's a pretty good chance I'll submit a PR for one or both of those issues.

(Of course... if both of those are implemented your plugin is almost a totally generic inline renderer -- any delimiter, custom renderer, any tags. But, that's not a negative. It's neither here nor there.)