Update md_browser to work with python-markdown v3.
Perhaps no one has tried to use this tool in a long time? In any case,
it wasn't working for me locally on Windows; this fixes it.
Bug: none
Change-Id: Iee762a62e7c1e4998c3dcc0fd6ca7d20ede664f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4114622
Auto-Submit: Peter Kasting <[email protected]>
Reviewed-by: Dirk Pranke <[email protected]>
Commit-Queue: Peter Kasting <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1084509}
diff --git a/tools/md_browser/gitiles_autolink.py b/tools/md_browser/gitiles_autolink.py
index 54bd9aa..7077e22 100644
--- a/tools/md_browser/gitiles_autolink.py
+++ b/tools/md_browser/gitiles_autolink.py
@@ -23,11 +23,12 @@
class _GitilesSmartQuotesExtension(Extension):
- """Add Gitiles' simpler linkifier to Markdown."""
+ """Add Gitiles' simpler linkifier to Markdown, with a priority just higher
+ than that of the builtin ''autolink''."""
def extendMarkdown(self, md):
- md.inlinePatterns.add('gitilesautolink',
- AutolinkInlineProcessor(AUTOLINK_RE, md), '<autolink')
+ md.inlinePatterns.register(AutolinkInlineProcessor(AUTOLINK_RE, md),
+ 'gitilesautolink', 122)
def makeExtension(*args, **kwargs):