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

Syntax highlighter does not escape XML-entities when language is unknown or unspecified #3220

Open
hexwayteam opened this issue Jan 25, 2024 · 0 comments · May be fixed by #3221
Open

Syntax highlighter does not escape XML-entities when language is unknown or unspecified #3220

hexwayteam opened this issue Jan 25, 2024 · 0 comments · May be fixed by #3221
Labels

Comments

@hexwayteam
Copy link

Describe the bug

Code sample inside code block get interpreted as HTML-tags while using codeSyntaxtHighlight + Prism without specifying a language

To Reproduce

Fiddle: https://jsfiddle.net/xv09fd76/

const { Editor } = toastui;
const { codeSyntaxHighlight } = Editor.plugin;

const viewer = new Editor.factory({
  el: document.getElementById('viewer'),
  viewer: true,
  initialValue: `\`\`\`
  Image tag: <img src="example.com">
  Div tag: <div data-foo="bar" style="color: red">Hello!</div>
  \`\`\``,
  plugins: [[codeSyntaxHighlight, { highlighter: Prism }]]
});

Expected behavior

Code samples aren't interpreted as HTML

Desktop (please complete the following information):

  • OS: any
  • Browser: Firefox, Chrome
  • Version: 3.2.2

Smartphone (please complete the following information):

not tested

Additional context

HTML tags are correctly escaped when correct language is specified:

```html
<div />
```

HTML-tags are also correctly escaped without codeSyntaxHIghlight-plugin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant