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

second curly braces removed #58

Closed
aaronh86 opened this issue Apr 18, 2018 · 8 comments
Closed

second curly braces removed #58

aaronh86 opened this issue Apr 18, 2018 · 8 comments

Comments

@aaronh86
Copy link

Wiki.JS are using your package. I was having issues with the math function and tracked it back to when your package is used and I enter {1}{2}, it removes the second curly braces.
Is there some way to fix this in your package?
Example input:

{1}{2}

Current output:

{1}

Expected output:

{1}{2}
@aaronh86 aaronh86 changed the title replaces second curly braces second curly braces removed Apr 18, 2018
@arve0
Copy link
Owner

arve0 commented Apr 18, 2018

Hi! Thanks for reporting. This sounds like a bug. I will take a look at it when I find some time. In the meantime you can take a look at the code yourself.

@CalebKester
Copy link

What would the fix for this be? require it to start with . or # or contain a = so you only capture classes, id's or attributes?

Just wondering as I'm running into a similar issue and my workaround is just {1}{2}{}.

@arve0
Copy link
Owner

arve0 commented May 5, 2018

Attributes are not allowed to start with numbers, so the plugin should correctly detect if what's inside the curlies are actual attributes.

Edit: This statement is not correct according to the HTML5 spec.

@arve0
Copy link
Owner

arve0 commented May 6, 2018

I've looked into the spec of HTML5 attributes, and it is quite permissive. <p 1> is actually allowed. This means that there is no way for the plugin to detect the intent of {1} vs {a=1} based on correctness. Both are allowed attributes.

This is not what you want, so you should do a fork an mold utils.hasCurly to fit your use case. For example, adjust minCurlyLength here: https://github.com/arve0/markdown-it-attrs/blob/master/utils.js#L140

You can install your own fork with npm install yourGithubUsername/markdown-it-attrs (pulls from github master branch).

Hope this helps you 😸

@arve0
Copy link
Owner

arve0 commented May 20, 2018

As of v2.1.0 you can configure which delimiters you use. See custom delimiter in the readme.

@CalebKester
Copy link

@arve0 any chance you could support delimiters > 1 character? example: {{{

@arve0
Copy link
Owner

arve0 commented May 22, 2018

@CalebKester Tracked in #65

@CalebKester
Copy link

Thanks! Wasn't sure it was intended behavior so thanks for opening that.

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

No branches or pull requests

3 participants