-
Notifications
You must be signed in to change notification settings - Fork 23
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
[RFC] module/package level pragma {.doctype: markdown|rst.}
to help migrate docs from RST to Markdown
#68
Comments
{.doctype: markdown|rst.}
to help migrate docs from RST to Markdown {.doctype: markdown|rst.}
to help migrate docs from RST to Markdown
How do I write
in markdown? |
You'd need |
If we're going to move to a new format then I vote for asciidoc ;) |
Ok, so it's just some poorly thought-out proposal causing lots of friction, yay. |
you don't. this, along with the phone book, has been deprecated in the modern world in favor of search. |
Oh really, but Nim's search uses |
how.. quaint ;) |
can we start with gradual migration of rst files to markdown? Here's a typical example where rst falls short: https://raw.githubusercontent.com/nim-lang/Nim/devel/doc/codeowners.rst renders as https://github.com/nim-lang/Nim/blob/devel/doc/codeowners.rst an entire table is missing (Compiler table), probably due to some obscure easy to miss syntax error noone noticed. This happened to me with rst files in other context, where code snippets were missing. |
@timotheecour To be fair, that's only due to differences between githubs and Nims RST parsers. It renders fine on the website. That problem wouldn't go away by replacing RST - markdown is notoriously ill-specified, especially when it comes to non-standard features like tables. IMO if Nim is going to switch to markdown, there first must be a pure Nim implementation. Preferable one that implements a well specified form of markdown like CommonMark (note however that commonmark does not support anything fancy like tables). |
I think it's fair to assume a lot of people will browse through sources via github ( eg https://github.com/nim-lang/Nim/blob/devel/doc/codeowners.rst) so silently skipping entire sections (tables here, code blocks in other cases I ran into) is a bit of an issue...
tables need to be supported...
IIRC markdown will at least always render something (even if badly), but it won't skip anything, as is the case with RST as domonstrated above. |
Luckily, @soasme is working on one 😄 https://github.com/soasme/nim-markdown |
Thanks for the citing, @citycide. And Thanks again for @dom96 merging the package publishing PR the other days. In the latest version bumping (v0.3.0), I've added the table support. In the next few days, I'll add more test cases to make it more stable. It could be awesome if nim-markdown can be used. |
Yeah, RST sucks which is why Nim's RST parser deviates from the standard... And yeah, markdown has the same problems. |
@soasme I'll happily use it on the Nim forum. :) |
/cc @Araq
|
So what, markdown has significant trailing whitespace. I mean seriously, it's all pretty bad. |
we don't have to use features we don't like and we can easily write a linter to reject that (eg in a github hook / in CI). instead of using trailing whitespace for newline, we can just use the popular extension
|
Well I would like to add my two cents. Documentation in Nim is written in neither markdown nor RST. It is written in whatever the documentation parser understands. And the documentation parser understands an RST/Markdown hybrid. So people care write their comments in whatever they want to write it in. Enforcing a specific style of doc comments is not something for a pragma, it is the job of a linter. So my vote for the pragma is a no. |
There simply isn't so much of a difference between Markdown and RST. Rejected. Also: The docgen now supports more markdown features. |
Implements nim-lang/RFCs#68 , see also discussion in nim-lang#17987 The permitted values: * `markdown`, which is default. It still contains nearly all of the RST supported but it is assumed that in time we will give up most or all RST features in this mode * `rst`, without any extensions * `RstMarkdown` — compatibility with Nim 1.x. It's basically RST with those Markdown features enabled that don't conflict with RST.
* Add `doctype: RST|Markdown|RstMarkdown` pragma Implements nim-lang/RFCs#68 , see also discussion in #17987 The permitted values: * `markdown`, which is default. It still contains nearly all of the RST supported but it is assumed that in time we will give up most or all RST features in this mode * `rst`, without any extensions * `RstMarkdown` — compatibility with Nim 1.x. It's basically RST with those Markdown features enabled that don't conflict with RST. * Apply suggestions from code review Co-authored-by: Clay Sweetser <[email protected]> * Additional fix in spirit of review * Fix test after #20188 Co-authored-by: Clay Sweetser <[email protected]>
* Add `doctype: RST|Markdown|RstMarkdown` pragma Implements nim-lang/RFCs#68 , see also discussion in nim-lang#17987 The permitted values: * `markdown`, which is default. It still contains nearly all of the RST supported but it is assumed that in time we will give up most or all RST features in this mode * `rst`, without any extensions * `RstMarkdown` — compatibility with Nim 1.x. It's basically RST with those Markdown features enabled that don't conflict with RST. * Apply suggestions from code review Co-authored-by: Clay Sweetser <[email protected]> * Additional fix in spirit of review * Fix test after nim-lang#20188 Co-authored-by: Clay Sweetser <[email protected]>
There seems to be a consensus (or near-consensus) that markdown is preferred over RST for documentation, see https://forum.nim-lang.org/t/4280 (Drop RST and join the Markdown train?) and that the only valid argument for keeping RST is historical reason.
A number of people have also noted that supporting a hybrid will just cause more issues, so let's explore practical ways to gradually migrate docs to markdown.
To ease the migration I propose the following:
introduce a module/package-level annotation
{.doctype: markdown|rst.}
which states how to interpret documentation comments (as either markdown or RST depending on doctype).usage
so
doctype
would only have to be specified at a few places (eg just 1, in nimble/nim.cfg/config.nims) until this becomes the new default.automating documentation source code migration from rst to markdown
The text was updated successfully, but these errors were encountered: