-
-
Notifications
You must be signed in to change notification settings - Fork 194
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
Support GitHub Flavored Markdown or at least CommonMark #401
Comments
Thanks for raising this! I do agree that getting close to GitHub Flavored Markdown is desirable, but there are a few practical reasons why that's a bit tricky. For some context, pdoc currently uses markdown2 with some extras enabled:
What's very nice about markdown2 is that it has an excellent track record of being maintained since 2008, it is written in pure Python (which makes distribution much easier), and it is a self-contained file (we include a copy in pdoc, which ensures that we're always API-compatible). GitHub uses https://github.com/github/cmark-gfm/, which is written in C. While there are Python bindings available (e.g. https://github.com/theacodes/cmarkgfm), but they all require binary wheels or a working compiler on the user's system. This limits us in multiple ways:
Now of course we could switch to another pure Python parser, but that hardly improves the situation - they all deviate from GFM in one way or another, and we're already relatively close to GFM anyways. For the record, pure CommonMark is missing a few extras that we want to keep, so it's not a good option either. Long story short, for now I'd suggest we do the following two things:
|
Thanks for responding so quickly! You raise some compelling points, and I can see how that's led to the current state of the project.
Would you consider then letting the user decide by taking advantage of extras? e.g.:
Under this regime you could also offer a
Hey, I mean, that's nice :) I think this may reveal a greater issue of what I want and may find reasonable conflicts with what other's want and find reasonable. For every person who doesn't want Maybe this should be another discussion/issue, but I think the markdown2 extensions |
I would be very hesistant to do that because it adds additional complexity1 and long-term maintenance overhead. We need to keep in sync with multiple other Markdown implementations2, which have different feature sets.3 I don't think the benefit justifies the costs.
One objective for pdoc is to be simple and not require any configuration. Adding additional configuration knobs works against this goal. From my experience, good documentation is usually not held back by a lack of doc tool configuration options. As mentioned in the README, there comes a point where you want to check out Sphinx instead if you require more customizability. We provide a set of command line options for the most common needs, but I don't personally think this crosses the bar. Sorry. :) If you strongly prefer GFM, you can of course always use pdoc as a library: #!/usr/bin/env python3
import sys
import cmarkgfm
from pdoc import render
from pdoc.__main__ import cli
render.env.filters["to_html"] = cmarkgfm.github_flavored_markdown_to_html
cli(sys.argv[1:]) The implicit downside is that this is code you need to maintain yourself. 😉 Footnotes
|
Ok makes sense! Thanks for entertaining the request. I may submit a PR adding documentation or a section into the README describing that |
Hello @mhils Mayabe a silly a question, but is I'm using https://github.com/executablebooks/markdown-it-py for other things and if I could just whoe-horn it into pdoc (at my peril, of course) would make things more consistent for us. |
Pretty much, yes. Two minor limitations come to mind:
|
Well, it just worked! |
Done, thanks for the good suggestion! :) |
Problem Description
Given the proliferation and ubiquity of GitHub, I believe many unassuming developers (myself included) naively believed what Markdown syntax is supported on GH is part of the original 2004 Markdown spec. Even if developers knew the difference, that they would prefer GitHub as that's what's most common. #64 suggests this conflation is a problem.
I personally stumbled across then when I wanted a URL to automatically be hyperlinked with
pdoc
, not realizing the original spec requires the URLs to be wrapped in<
and>
characters. In a phrase: I've become spoiled by GFM.Proposal
Support the GitHub Flavored Markdown spec.
This can take place in a few possible ways:
-d gfm
or-d github-markdown
flag, reserving the-d markdown
flag for the original 2004 specpdoc
with the GFM version by default, optionally exposing a-d original-markdown
for the 2004 specAlternatives
I guess not supporting GFM at all?
Independent of my proposal,
pdoc
should probably declare what version or flavour we colloquially know/call as "Markdown". The original is from 2004 released as a Perl script and has remained largely unchanged, warts and all.CommonMark appears to be the, well, common and well-defined and versioned specification of the original Markdown. Indeed, GFM is derived from CommonMark!
I would hope that
pdoc
would choose a version of the CommonMark spec and support that version explicitly.Additional context
The Differences from original Markdown section of commonmark-spec's README is enlightening.
The text was updated successfully, but these errors were encountered: