-
Notifications
You must be signed in to change notification settings - Fork 123
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
Support $$ as delimiter for math formula #1754
Comments
Thanks for bringing this up @tlylt No strong views from my side, as I don't use math formulae in MarkBind sites. Others are welcome to give inputs. |
@tlylt I think allowing the use of
I'm not too sure about this as allowing users to specify their own delimiter can cause some issues in the future when MarkBind introduces new delimiters for new features (e.g the |
Ahh I see. I prefer supporting them interchangeably since both the dollars and brackets delimiters will be reserved for this specific function. I don't really see a benefit for users to specify one of them in |
Hi @jonahtanjz, I am able to support both syntaxes by loading the plugin markdownIt.use(require('markdown-it-mark'))
//...
.use(require('markdown-it-texmath'), { engine: katex, delimiters: 'brackets' })
.use(require('markdown-it-texmath')) On the functionality side, it looks ok but I'm not sure if there's anything to be concerned about for performance or otherwise. Any thoughts? Couldn't really find anything related to loading a plugin twice. If this works then it's probably the least expensive change required. |
Seems like including the plugin twice works quite well although it looks a little "hacky" 🤣 Performance wise shouldn't be too much overhead from what I can see (the largest one is probably importing the katex package). The other alternative is to patch it to allow for |
Based on this and this, seems like the import statement should not be too problematic as explained below:
|
@jonahtanjz I am planning to implement the "hacky" solution as an optional plugin that users can choose to turn on if needed. The reason is that we already support one syntax for math formulae and this is more of customization for anyone who needs it. |
Since the overhead is not too problematic and it is an optional plugin that user can include, then I think this approach is fine. |
Is your request related to a problem?
When trying to import some content that I authored using a markdown editor with mathjax support, I discovered that the
$ $
$$ $$
delimiters are not working due to the choice of brackets over dollars as a delimiter in PR #1335.This was with the consideration that
$$ $$
was planned to serve as delimiters for underline. However, in issue #28,!! !!
was chosen for underline instead.Since we have freed up
$$$$
, perhaps we can allow user to configure the delimiter of their choice for better support for math related content.Describe the solution you'd like
Allow users to specify the delimiter of their choice in
site.json
Describe alternatives you've considered
Since I am not sure the exact proportion of people who use brackets as delimiters for tex, I guess the default delimiter can stay as it is. The alternative is for authors to convert their syntax from dollars to brackets, which as acknowledged in this #28 (comment) ...is not very user friendly.
The text was updated successfully, but these errors were encountered: