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

docs: fix markdown parsing issue with underscores in link attributes and italic text #76

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

codytubbs
Copy link

The python-markdown parser (via md_in_html extension) incorrectly handles underscores when a {:target="_blank"} attribute is combined with markdown italic text on the same line.

Current Behavior

In docs/why_this_guide.md, lines containing both link attributes and italic text are parsed incorrectly:

In [VU#425163]([https://kb.cert.org/vuls/id/425163){:target="_blank"}](https://kb.cert.org/vuls/id/425163)%7B:target=%22_blank%22%7D) _Machine learning classifiers ..._

Generates incorrect HTML:

<p>In <a href="[https://kb.cert.org/vuls/id/425163"><abbr](https://kb.cert.org/vuls/id/425163%22%3E%3Cabbr) title="CERT Vulnerability Note">VU#</abbr>425163</a>{:target="<em>blank"} _Machine learning classifiers trained via gradient descent are vulnerable to arbitrary misclassification attack</em>,

Root Cause

The md_in_html extension (enabled in mkdocs.yml) appears to misinterpret the underscore in _blank as a markdown italic marker when it appears before other italic text.

Solution

Escape the underscore in _blank when on the same line as italic text.

{:target="\_blank"}

Testing

Parsing comparison available at: https://babelmark.github.io/?text=In+%5BVU%23425163%5D(https%3A%2F%2Fkb.cert.org%2Fvuls%2Fid%2F425163)%7B%3Atarget%3D%22%5C_blank%22%7D+_Machine+learning_%2C%0A%0AIn+%5BVU%23425163%5D(https%3A%2F%2Fkb.cert.org%2Fvuls%2Fid%2F425163)%7B%3Atarget%3D%22_blank%22%7D+_Machine+learning_%2C
note: scroll down to section 2 to view results from python-markdown

Related Configuration

This issue involves the md_in_html extension listed under markdown_extensions in mkdocs.yml, which is likely related to the mkdocs-material* requirements.

Contributions to this project are subject to the terms listed in CONTRIBUTING.md.

In the 'Larger Cases Face Increased Leak Risk' example within docs/howto/coordination/maintaining_secrecy.md
…and italic text

The `python-markdown` parser (via `md_in_html` extension) incorrectly handles underscores when a `{:target="_blank"}` attribute is combined with markdown italic text on the same line.

## Current Behavior
In `docs/why_this_guide.md`, lines containing both link attributes and italic text are parsed incorrectly:

```markdown
In [VU#425163](https://kb.cert.org/vuls/id/425163){:target="_blank"} _Machine learning classifiers ..._
```
Generates incorrect HTML:
```html
<p>In <a href="https://kb.cert.org/vuls/id/425163"><abbr title="CERT Vulnerability Note">VU#</abbr>425163</a>{:target="<em>blank"} _Machine learning classifiers trained via gradient descent are vulnerable to arbitrary misclassification attack</em>,
```

## Root Cause
The `md_in_html` extension (enabled in `mkdocs.yml`) appears to misinterpret the underscore in `_blank` as a markdown italic marker when it appears before other italic text.

## Solution
Escape the underscore in `_blank` when on the same line as italic text.
```markdown
{:target="\_blank"}
```

## Testing
Parsing comparison available at: https://babelmark.github.io/?text=In+%5BVU%23425163%5D(https%3A%2F%2Fkb.cert.org%2Fvuls%2Fid%2F425163)%7B%3Atarget%3D%22%5C_blank%22%7D+_Machine+learning_%2C%0A%0AIn+%5BVU%23425163%5D(https%3A%2F%2Fkb.cert.org%2Fvuls%2Fid%2F425163)%7B%3Atarget%3D%22_blank%22%7D+_Machine+learning_%2C
note: scroll down to section 2 to view results from `python-markdown`

## Related Configuration
This issue involves the `md_in_html` extension listed under `markdown_extensions` in `mkdocs.yml`, which is likely related to the `mkdocs-material*` requirements.
codytubbs added a commit to codytubbs/CERT-Guide-to-CVD that referenced this pull request Nov 16, 2024
…and italic text

corrected within docs/topics/phases/deployment.md

related to CERTCC#76
codytubbs added a commit to codytubbs/CERT-Guide-to-CVD that referenced this pull request Nov 16, 2024
…text

Corrected within docs/topics/phases/remediation.md

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

Successfully merging this pull request may close these issues.

1 participant