getpelican / pelican

Static site generator that supports Markdown and reST syntax. Powered by Python.
https://getpelican.com
GNU Affero General Public License v3.0
12.37k stars 1.8k forks source link

Move Markdown down to a plugin of a new Convert class. #3344

Closed egberts closed 20 hours ago

egberts commented 1 week ago

Feature Request

In light of the latest Markdown coming ahead called Markdown-It, which is now CommonMark-compliant as well as GitHub Markdown as an extension, which supplanted the Markdown (MD1, MD2, MD3, MD4), MetaMarkdown (MMD), and sundown, we should consider the future plan of supporting plugin-scheme for such markdown formats.

I think it would be helpful to start moving current Markdown package use by Pelican from an hardcoded approach toward a future-friendly plug-in approach thus making it easier to take on various MD plugins.

(Unless I am missing some pelicanconf.py setting for disabling this hardcoded Markdown package somehow).

MinchinWeb commented 1 week ago

Possible duplicate of https://github.com/getpelican/pelican/issues/2984

Switching the Markdown renderer can be done by writing a (Pelican) plugin, and as per #2984, seems to be the preferred solution.

If you don't have markdown installed, then the built-in renderer doesn't run.

As for the (Python) markdown package, it pre-dates CommonMark and doesn't consider itself replaced by it, and continues to be maintained.

justinmayer commented 1 week ago

I believe @MinchinWeb summarized things very nicely. A few follow-up thoughts…

  1. I think using terms like "hardcoded" is a bit misleading. As @MinchinWeb said, if the Python-Markdown package is not installed, then that Markdown renderer does not run. So there is no need to explicitly disable it.
  2. As @MinchinWeb said (and has demonstrated), alternative Markdown parsers can already be supported via Pelican plugins.
  3. Python-Markdown continues to be an excellent and well-maintained Markdown parser and is not in need of replacement for most people. It has a very rich third-party extension eco-system that as far as I can tell cannot be matched by any alternative Markdown parser (including markdown-it-py).
  4. It seems to me that moving the current built-in support for Python-Markdown into a separate plugin would require considerable effort with uncertain benefit. If someone volunteers to undertake such an endeavor, we could discuss further.
egberts commented 1 week ago
  1. I think using terms like "hardcoded" is a bit misleading. As @MinchinWeb said, if the Python-Markdown package is not installed, then that Markdown renderer does not run. So there is no need to explicitly disable it.

Of course, this could be a problem if virtual environment is not being used if markdown package is installed for use by a non-Pelican application and one should desire not to use this particular Markdown package for Pelican.

(That was my scenario, a pesky hassle but not an unsolvable one at that, as I work on expanding table's style/class enhancement of just_table plugin).

egberts commented 20 hours ago
  1. Python-Markdown continues to be an excellent and well-maintained Markdown parser and is not in need of replacement for most people. It has a very rich third-party extension eco-system that as far as I can tell cannot be matched by any alternative Markdown parser (including markdown-it-py).

After reviewing the various alternatives to current Pelican's selection of Markdown, I agree that this suggested step should be deferred until one of THOSE "better outputters" get their customization made a lot more accessible (to Pelican, at least).

Sidenote: This means that my zeal to adding a more robust table plugin has become more desired.

Closing this issue.