Do we need to maintain a separate fork of markdown?
Opened this issue · 2 comments
As discussed in #47 (comment), the markdown changes landed in #11 break our Python 2 implementation. Do we need to maintain a separate fork of markdown or can we isolate our required functionality in some other way?
Tracking issue for 6a54f06#r35284462 and 6a54f06#r35284484
I think @hornc's #58 fixed the immediate problem.
I've reviewed the integration points and I think it should be straightforward to switch to the standard python-markdown. The only area with any risk is the custom infogami macro extension and it's small enough that it should be straightforward to update for any changes to the Markdown extension API
Relevant modules:
https://github.com/internetarchive/infogami/blob/master/infogami/utils/macro.py#L13
https://github.com/internetarchive/infogami/blob/master/infogami/utils/view.py#L18
https://github.com/internetarchive/openlibrary/blob/master/openlibrary/core/olmarkdown.py
These are the interfaces that I can find to Markdown from other parts of infogami and openlibrary:
- Footnote extension - now part of the standard distribution: https://python-markdown.github.io/extensions/footnotes/
- infogami macro extension - needs to be ported to or verified with the current Markdown extension API - https://python-markdown.github.io/extensions/api/
- there's a mechanism for registering post processors, which is used to register the wikilinks() postprocessor, used in these two (identical) modules:
infogami/infogami/plugins/review/view.py
Line 23 in 956507c
infogami/infogami/plugins/links/view.py
Line 23 in 956507c
It's likely this could be changed to the standard WikiLinks extension - https://python-markdown.github.io/extensions/wikilinks/ - Line break preprocessor - defined in OpenLibrary - could probably use the official New-Line-To-Break extension https://python-markdown.github.io/extensions/nl2br/
- Autolink preprocessor - I can't find confirmation, but I think all URLs are automatically linked now as default behavior