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

Avoid updating linkdef when title isn't followed by NL #792

Merged
merged 3 commits into from Jan 14, 2024

Conversation

notriddle
Copy link
Collaborator

@notriddle notriddle commented Nov 25, 2023

The quoted text '[foo]' should either be treated as a paragraph, or as a title attribute. The reference implementation thinks it's just text, not a title. But pulldown-cmark treated it as both, generating <p>'<a href="https://example.com" title="[foo]">foo</a>'bar</p>, which is definitely wrong.

Fixes #791

notriddle and others added 3 commits November 25, 2023 16:34
The quoted text '[foo]' should either be treated as a paragraph,
or as a title attribute.
The reference implementation thinks it's just text, not a title.
But pulldown-cmark treated it as both, generating
`<p>'<a href="https://example.com" title="[foo]">foo</a>'bar</p>`,
which is definitely wrong.
The problem here is that `scan_refdef` didn't scan the
line break, except after quoted titles. This commit
makes it behave consistently, relying on the caller to
do that.

Events from pulldown-cmark:

```rust
"+ [^]:[\n'\n'\n\\\n" -> [
  Start(List(None))
    Start(Item)
    End(Item)
  End(List(false))
  Start(Paragraph)
    Text(Borrowed("\\"))
  End(Paragraph)
]
```

Events from pandoc:

```rust
"+ [^]:[\n'\n'\n\\\n" -> [
  Start(List(None))
    Start(Item)
      Text(Boxed("\\"))
    End(Item)
  End(List(false))
]
```

Events from commonmark.js:

```rust
"+ [^]:[\n'\n'\n\\\n" -> [
  Start(List(None))
    Start(Item)
      Text(Boxed("\\"))
    End(Item)
  End(List(false))
]
```
@Martin1887 Martin1887 merged commit 138a764 into pulldown-cmark:master Jan 14, 2024
1 check passed
@notriddle notriddle deleted the notriddle/title-nl branch January 14, 2024 17:20
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.

[fuzz result] quoted text is either just text, or a link title, but not both
2 participants