-
Notifications
You must be signed in to change notification settings - Fork 107
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
"Expected valid tag name" when using special characters like < #76
Comments
Interesting, I would expect using a raw |
They are getting decoded by the markdown parser, this problem is a litle more complex than I thought. I have a potential solution but I'm going to see if there is a simpler way of solving the problem. In other news my investigations have uncovered another bug, the following does not work either: - 1 {"<"} 2 When |
I can feel another custom node type coming on (for entities), modifying the parser seems to be the "best" approach and should be less work than trying to selectively undo the entity decoding in the transform phase. |
Thank you for the investigation! The custom node type sounds good to me. |
Try to use |
I'm running into this with Katex as well: #113 |
This will be partially addressed by the work discussed in #116. I can make |
#113 has some other information and a nice test case. |
I wonder if mdsvex should interpret |
Yeah, I am considering this for For curly braces, I'm less certain. It is quite common to have leading and trailing spaces for text expressions (example). I think block syntax requires there to be no space before the Curly braces are just generally problematic, they are quite commonly used in custom markdown syntax for additional metadata/ attributes but they pose a bit problem because of their importance to svelte. I'll take a look at some popular use-cases and see if I can figure out a way to disambiguate them when I start work on yet another parser for mdsvex. I have a new parser (the |
Is there a workaround for now ? I tried the following in the playground and all fails 5 < 10 5 < 10 5 {"<"} 10 5 {<} 10 5 {@html <} 10 5 {@html <} 10 |
Its awful but double escaping seems to work:
It doesn't work in the playground though. For some reason |
The commonmark specification has a list of rules for what constitutes legal tags. Anything that isn't a valid tag is escaped. This example shows a < followed by a space is not considered a valid tag name. Eg, Commonmark has a test suite of JSON content. We should get that test suite passing in mdsevx. |
Yes, this is compounded in plugins as well, for example I started using I guess it would be cool to have more control over it, maybe when this conversion occurs in the mdsvex pipeline? maybe choose the types of elements it operates on? |
Mdsvex will never be commonmark compliant. Even less so I'm 1.0. That said, for 1.0, I'll be porting/modifying the commonmark test cases across and restricting html syntax to solve this issue. In the current implementation there isn't anything that can be done about it. I'm working on the 1.0 parser now, which will bring this under my control. |
Hello, has this been addressed in a more reliable way than needing to double-escape the |
Hi, this issue still persists on version |
Fixed in my proposed #692 (^: |
Hello @pngwn, thank you for this great project!
I am having an issue when using the
<
character inside a Markdown file. Even when replacing it with<
. It seems the<
gets replaced by<
again resulting in the same error from the svelte compiler ("Expected valid tag name"). I even tried to escape the character with\
without success.Is there any way to escape special characters so the svelte compiler does not throw an error?
My current "solution" is to wrap
<
inside an inline code block but I do not want to show that part as code. This is the Markdown file I am talking about: https://github.com/nymea/nymea-plugins/blob/rework-readmes/awattar/README.md This is the version with the "fixed" inline code blocks. When removing those, the error gets thrown.I am not sure if this is a bug or if I miss something here. Just found this code section in MDSveX:
So I guess the
<
character should only be replaced inside code blocks as mentioned in the comment, but using<
leads to the same error because somewhere during the preprocess it gets replaced with<
again.The text was updated successfully, but these errors were encountered: