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

Exclude event attributes when rendering markdown #9463

Closed
jmooring opened this issue Feb 4, 2022 · 1 comment · Fixed by #9464
Closed

Exclude event attributes when rendering markdown #9463

jmooring opened this issue Feb 4, 2022 · 1 comment · Fixed by #9464

Comments

@jmooring
Copy link
Member

jmooring commented Feb 4, 2022

Current Behavior

config.toml

[markup.goldmark.renderer]
unsafe = false

[markup.goldmark.parser.attribute]
block = true
title = true

markdown

## Heading {onclick="alert('heading')"}

> Blockquote
{ondblclick="alert('blockquote')"}

```bash {onmouseover="alert('code fence')"}
codefences
```

renders

<h2 onclick="alert('heading')" id="heading">Heading</h2>

<blockquote><p>Blockquote</p></blockquote>

<div class="highlight" onmouseover="alert('code fence')">...

Desired Behavior

Remove attribute events from headings and code fences. The block attributes are already being sanitized.

<h2 id="heading">Heading</h2>

<blockquote><p>Blockquote</p></blockquote>

<div class="highlight">...

Reference:

Testing:

git clone --single-branch -b hugo-github-issue-9463 https://github.com/jmooring/hugo-testing hugo-github-issue-9463
cd hugo-github-issue-9463
hugo server
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 18, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants