-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Does not recognise custom html elements #283
Labels
Comments
+1 |
3 similar comments
+1 |
+1 |
+1 |
joshbruce
added
has PR
The issue has a Pull Request associated
NFS - new feature (spec related)
labels
Dec 6, 2017
See #956 FF was a hold out on implementing this until the spec stabilized. Working on cleaning house, thank you for the PR. https://developer.mozilla.org/en-US/docs/Web/Web_Components/Custom_Elements |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
tldr;
Custom html elements are coming, and
marked
does not currently recognise them as valid html. Custom elements may have different escaping requirements for their content based on whether the elements contains more elements (likediv
) or plain text (likescript
). Perhaps it would be possible to pass which html tags to escape/not escape as configuration properties.Backstory
I've been experimenting with custom elements and I wanted to inject some into my markdown presentation.
Source
play-script
is essentially ascript
tag that renders its content, highlighted with highlight.js, and executes only when you click on it.Problem: currently
marked
does not recognise tags with hyphens in them as valid html. To get around this quickly, I loosened the html detection regex to also match tags with a single hypen:Source
This successfully recognised my custom tag
play-script
as html, but it raised a new issue:My custom tag's content was text as opposed to more xml tags, so marked would html-escape all of my script contents. This was no good since I wanted that text to remain as executable script (perhaps I should have looked at unescaping).
So as a hack to make it work, I reluctantly added my specific tag, (and the
template
tag) as special-cased to avoid escaping, along withstyle
,pre
andscript
:Source
Special-casing my custom element is clearly not at all a solution, but perhaps the tags that are matched here could be passed in as configuration properties.
The text was updated successfully, but these errors were encountered: