Skip to content

fix(webhost): rewrite doc image URLs on mistune 3.4 - #196

Open
lallaria wants to merge 1 commit into
mainfrom
didi/beta-test-suite-mwgg-gui-d3894a
Open

lallaria wants to merge 1 commit into
mainfrom
didi/beta-test-suite-mwgg-gui-d3894a

Conversation

@lallaria

Copy link
Copy Markdown
Contributor

Scope

Image URL rewriting for rendered docs in WebHostLib/markdown.py.

Description

  • mistune 3.4 builds image tokens when the closing bracket is parsed, so the parse_link override no longer saw them and relative doc images kept their unrewritten URLs.
  • ImgUrlRewriteInlineParser now rewrites image URLs on the finished token tree, which also reaches images nested inside links and emphasis. The mistune>=3.3.0,<4 range is unchanged.

WebHostLib/markdown.py: rewrite image URLs by walking the finished token tree in ImgUrlRewriteInlineParser.__call__. mistune 3.4 builds images when the closing bracket is parsed, so the parse_link override no longer saw them.
test/webhost/test_markdown.py: cover images inside links, emphasis and reference links.
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