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 inline html in markdown?

See original GitHub issue

So Markdown supports inline HTML, and TUI editor reflects inline HTML in the preview. But we don’t want the users to be able to use inline html - ideally the user could type, say <b>Hey</b> but it would be shown escaped, both in preview and in WYSIWYG editor. How can we do that with TUI?

I suppose we can’t use the HTML sanitizer, as sanitizer works after markdown has already been converted to HTML.

Ideally, there should be a convertorBeforeMarkdownToHtmlConverted event.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
seonim-ryucommented, Nov 12, 2019

@docent Sorry for the late response.

Is this the situation you are talking about?

  1. In the Markdown editor, enter html as follows:
<b>foo</b>
<i>bar</i>
  1. Through some preprocessing, such as an event, the tags appear to be escaped in Markdown Preview or in WYSIWYG. mde

If this is correct, I think we can use the previewBeforeHook and wysiwygSetValueBefore events. Like this:

editor.on('wysiwygSetValueBefore', html => {
  // ...
  return escapedHTML;
});

Can you check it?

1reaction
PeterDcslcommented, Jan 28, 2022

Hi! Sorry to resurrect such an old post, but I’m also trying to disable inline HTML for the markdown editor (but not the wysiwyg editor - we are not using that). I’ve been trying out customHTMLRenderer and beforePreviewRender, but these seem like dead ends. Is there a way to achieve this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Escaping Markdown Code Snippets and Inline Code as ...
In this code I tackle escaping Markdown code for nested code blocks and ... The inline code block renders as a <code></code> in...
Read more >
Markdown Syntax Documentation - Daring Fireball
Automatic Escaping for Special Characters. In HTML, there are two characters that demand special treatment: < and & . Left angle brackets are...
Read more >
How do I type html in a markdown file without it rendering?
You can escape the < characters by replacing them with < , which is the HTML escape sequence for < . You're sentence...
Read more >
How do I escape a backtick ` within in-line code in Markdown?
Use four spaces before your code: List`1. Or use double backticks: ``List`1`` produces List`1 .
Read more >
Basic Syntax - Markdown Guide
If the word or phrase you want to denote as code includes one or more backticks, you can escape it by enclosing the...
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