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

Upgrade mistune #81

Draft
wants to merge 12 commits into
base: develop
Choose a base branch
from
Draft

Upgrade mistune #81

wants to merge 12 commits into from

Conversation

galund
Copy link

@galund galund commented May 18, 2023

Several substantial changes to the Mistune API, requiring alteration to our custom renderer.

Many of the changes do result in a different rendering, and where I've judged these are probably acceptable I've adjusted the tests, rather than attempt to further customise the markdown handling.

This targets a release candidate of Mistune 3, as it didn't seem worth trying to target version 2 given the newer version's impending availability.

galund added 12 commits May 18, 2023 13:04
- header renderer function renamed to heading and args changed
- link arguments changed
- block_code arguments changed
- image arguments changed and local filepath needs URL-decoding

NB work in progress - tests not fixed
… separate elements

- new Mistune behaviour is correct
- we're trying to test a single blockquote with multiple paragraphs (where only the first line of each para has an angle bracket)
- so add the exrta angle bracket on the blank line, to correspond with the intended output
- no change to semantics of the output markup
… markup

- there is a substantial difference betwen the [syntax previously assumed](https://daringfireball.net/projects/markdown/syntax#list) and the [CommonMark syntax](https://spec.commonmark.org/0.30/#start-number)
- Mistune now follows CommonMark so the example doc must change

Arguably the example doc here is not testing md2cf functionality and should be removed

- It's not particularly useful to test a lib that we depend on, unless we are testing something that matters to Confluence
- Even then, deviation from CommonMark is not helpful, though potentially we could flag a warning somehow
…ownRenderer

- all code blocks end with a newline
- this means updating some examples in the functional test as they expected inconsistency
- add functional test of language tag on code block
- fix unit test for block_code given renamed parameter
- turns out this is easy to break as Mistune behaviour has changed
…ue to the Mistune upgrade

- each text callback occurs with a single line/token so doesn't receive the newline
- instead we define a special InlineParser that handles soft break as spaces rather than newlines
@galund galund mentioned this pull request May 18, 2023
@galund
Copy link
Author

galund commented May 18, 2023

"remove-text-newlines" isn't removing all the newlines it could/should at the moment :(

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