developit / developit/snarkdown
Links inside bold/italic text result in invalid HTML
- Dominant language
- JavaScript
- Stars
- 2.4k
- Forks
- 116
- PR merge metrics
- No merged PRs in 30d
Description
Links inside runs of bold or italic text are rendered as invalid HTML.
For example, the following Markdown:
```markdown
foo **[link](https://example.com)** bar
```
is rendered as:
```html
foo link bar
```
whilst the expected output would be:
```html
foo link bar
```
[More examples here](https://runkit.com/bock/5b0e748a072e510012552c4f).
Two things are unexpected here:
1. The output is invalid because the `` and `` tags are closed in the same order in which they're opened.
2. The `` tag is then re-opened and not closed until the end of the text, causing more of the text to be bold than intended.
The same happens when using `__` instead of `**`, as well as with italics (`_` or `*`).
When the formatting is _inside_ the link, the result is as expected:
```markdown
foo [**link**](https://example.com) bar
```
This renders as:
```html
foo link bar
```
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.