question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to escape html tag?

See original GitHub issue

Hi,

Is it possible to escape some html tag, or in another word, is it possible to only process some specified html tags? For example, I have below markdown:

<script>alert('hello');</script> script tag
<tag> unknown tag
<img src="abc.png" />

the html generated is:

<script>alert('hello');</script> script tag\n
<p><tag> unknown tag</p>
<img src="abc.png" />

while I’m expecting to get result like:

&lt;script&gt; alert('hello');&lt;/script&gt; script tag\n
<p>&lt;tag&gt; unknown tag</p>
<img src="abc.png" />

It would be great if there is an option to tell Flexmark to only process some specified tags, like img, a, but escape all others.

Best regards

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:15 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
vschcommented, Apr 7, 2017

@nanodeath, HTML applies to all HTML elements: block, block comments, inline and inline comments.

Markdown block HTML consists of HTML block tags that start a paragraph, inline HTML is any HTML that is part of a paragraph.

Block HTML: http://spec.commonmark.org/0.27/#html-blocks

<div>
     <p>test</p>
</div>

inline HTML: http://spec.commonmark.org/0.27/#raw-html

This paragraph has inline HTML <kbd>Keyboard</kbd>
0reactions
ssikurocommented, Feb 27, 2018

Thank you!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Escape tags in html - Stack Overflow
Those escapes are decimal ascii escapes. You can see the values here. Take a look at the HTML column.
Read more >
Guide to: Using HTML Tags/Characters in Labels
Escape characters will always begin with the ampersand symbol (&) and end with a semicolon symbol (;). The characters in between the ampersand...
Read more >
How to escape & unescape HTML characters in string in ...
Escaping HTML characters in a string means replacing the: ... We can escape the HTML of the string using the replace method of...
Read more >
How to Escape HTML Characters - Techstacker
How to Escape HTML Characters · Replace < with < · Replace > with > · Replace " with ".
Read more >
How to escape everything in a block in HTML ? - GeeksforGeeks
Escaping is a method that permits us to inform a computer to try to do something special with the text we supply or...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found