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

Characters are not escaped when a code block's language is set to text #54

Closed
AleksandrHovhannisyan opened this issue Jul 1, 2021 · 2 comments
Milestone

Comments

@AleksandrHovhannisyan
Copy link

Problem

When using fenced code blocks like this:

```text
some plain text code in here
```

The plain-text code is not properly escaped. So if it has < or >, those get rendered as literal tags and start throwing all kinds of HTML validation errors (this is currently affecting multiple pages on my site).

Steps to reproduce

  1. Create a basic 11ty site with this plugin installed.
  2. Create a markdown post with this code block:
```text
This <is> some text.
```
  1. Observe that the rendered source has unescaped characters.

Example:

image

Question

Is this not how I should be using the text language? I can render fenced code blocks without specifying any language, but then I don't get any classes on the rendered pre/code or any nested spans. I was under the impression that text should still escape characters.

kitschpatrol added a commit to kitschpatrol/eleventy-plugin-syntaxhighlight that referenced this issue Feb 27, 2022
@zachleat
Copy link
Member

zachleat commented Jun 28, 2022

text is a special escape hatch value in this plugin that opts out of syntax highlighting. If you want normal markdown escaping rules, remove text! See

```
This <is> some text.
```

@zachleat
Copy link
Member

As @svivian notes in #36 removing text also removes the styling but you can add a default class a la #66 (comment)

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

No branches or pull requests

2 participants