8000 DOC: First pass at format conversion, rst -> myst by rossbar · Pull Request #4863 · scikit-image/scikit-image · GitHub
[go: up one dir, main page]

Skip to content

DOC: First pass at format conversion, rst -> myst #4863

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

Merged
merged 18 commits into from
Aug 16, 2020

Conversation

rossbar
Copy link
Contributor
@rossbar rossbar commented Jul 29, 2020

Description

This PR encompasses a first past at converting the existing (non-generated) documentation from rST to myst markdown. Most of the files in the top-level toctree in source/index.rst have been converted.

The documentation build system requires an additional sphinx extension (myst_parser) in order to properly parse and build the docs. This extra dependency and associated configuration were added in 025424f, so the following procedure should be sufficient to build the docs:

pip install -r requirements/docs.txt
cd doc && make html

For reviewers

  • Check that the PR title is short, concise, and will make sense 1 year
    later.
  • Check that new functions are imported in corresponding __init__.py.
  • Check that new features, API changes, and deprecations are mentioned in
    doc/release/release_dev.rst.

rossbar added 13 commits July 28, 2020 18:16
 * Add myst-parser to doc requirements
 * Add myst-parser extension to conf.py
 * Start working on the overview doc.
 * Switch to #-based headings to suppress markdown parse warnings
 * ignore inconsistencies between emph/literal - assume all are
   intended to be inline literals
 * Leave link to INSTALL.rst using include directive.
 * Illustrate the toctree directive in myst syntax.
 * NOTE: Left CONTRIBUTING.TXT alone even though it has rst
   syntax as it might be used elsewhere.
@emmanuelle
Copy link
Member

Thanks @rossbar ! myst seems to be a really cool project. I was a bit surprised to see your PR since since had not been discussed in an issue previously but this is definitely interesting. Could you please give us a bit of context and information about how you did the reformatting (completely manually or with some script?)? Did you notice any pain points concerning myST during the conversion?

@rossbar
Copy link
Contributor Author
rossbar commented Jul 29, 2020

I was a bit surprised to see your PR since since had not been discussed in an issue previously

Sorry about dropping this in out of the blue with no context! Re: the conversion itself, I manually converted all of the files as an exercise rather than trying to automate the process. In general this was very straightforward, especially for a lot of the linking roles, where simple find/replace is sufficient (e.g. :ref: -> {ref}). The one pain point was that I didn't know how to replicate rst's piped variable replacement syntax (e.g. |version| in index.rst) in myst. I just wasn't sure how this particular (very nice) feature in rst mapped on myst syntax. Aside from this, every other feature was covered in syntax guide which I had to refer to for some features (e.g. footnotes).

@emmanuelle
Copy link
Member

Thanks for this feedback @rossbar. From what I read in the MyST doc, it's possible to have a mixture of md and rst files, including cross-references between the two languages.

@rossbar
Copy link
Contributor Author
rossbar commented Aug 3, 2020

. From what I read in the MyST doc, it's possible to have a mixture of md and rst files, including cross-references between the two languages.

Yes exactly, that's why I left e.g. index and release_notes_and_installation as .rst files since I wasn't quite sure how to replace the |piped| variable replacement syntax.

@stefanv
Copy link
Member
stefanv commented Aug 4, 2020

@emmanuelle Just to provide some background: I asked @rossbar to look into converting our documentation, especially narrative, into MyST, so that we can write in Markdown. I think this lowers the barrier for documentation contributors, and also for ourselves.

I noticed, e.g., that people often forget how to use RST links properly (I do too, it's pretty obcure). Is it one underscore, or two?

I previously tried to do this with recommonmark, but never had much success. MyST has worked flawlessly with other projects, though, so I thought we could give it a go. And, since @rossbar is the resident expert on MyST... :)

@emmanuelle
Copy link
Member

Reviewers: you can take a look at the newly added doc artifact to see the doc corresponding to this PR. Handy isn't it :-).

Ross: please pull from your branch as I solved a conflict.

@jni
Copy link
Member
jni commented Aug 4, 2020

One comment I have is that I think we should try to get sphinx-gallery to support MyST before converting. Otherwise, we are stuck using a mixture of ReST and Markdown. Or does this PR achieve that effect automagically? I think most new contributions are to the gallery examples, anyway.

@stefanv
Copy link
Member
stefanv commented Aug 4, 2020

I think Sphinx-Gallery supporting markdown / MyST is still a ways off. I don't see any reason not to make our documentation more pleasant to work on in the mean time?

@jni
Copy link
Member
jni commented Aug 4, 2020

Well, it complicates the contributing guide: "If working on these docs, do this. If working on these other docs, do this other thing..."

But, point taken. We have indeed had issues with sphinx building in some recent PRs. I was just flagging for discussion, I don't consider it a blocker.

@emmanuelle
Copy link
Member

See sphinx-gallery/sphinx-gallery#710 for sphinx-gallery and myst/markdown.

@stefanv
Copy link
Member
stefanv commented Aug 4, 2020

Well, it complicates the contributing guide: "If working on these docs, do this. If working on these other docs, do this other thing..."

Not ideal, I agree. Let's see how this PR turns out, then we can decide.

@emmanuelle
Copy link
Member

The formatting of some links in https://93-2014929-gh.circle-artifacts.com/0/doc/build/html/contribute.html did not turn out well.

@rossbar
Copy link
Contributor Author
rossbar commented Aug 5, 2020

The formatting of some links in https://93-2014929-gh.circle-artifacts.com/0/doc/build/html/contribute.html did not turn out well.

Good catch - this was a tricky one because all that doc/source/contribute contained was an .. include directive to ../../CONTRIBUTING.txt. I ended up deciding not to touch CONTRIBUTING.txt as I thought it might have other uses (e.g. the first time contributor blurb that pops up on github) since it lives outside of doc/. Since CONTRIBUTING.txt is in rST (despite the file extension), it probably makes sense to switch doc/source/contribute back to rst as well. Alternatively one could convert CONTRIBUTING.txt to md, but it would have to be github-flavored markdown.

@@ -11,4 +11,4 @@ Release notes
Installation
============

.. include:: install.rst
.. include:: install.md
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another good catch - this seems to stem from the same cause as the problem in the above comment (include-ing an .rst formatted file from outside of the docs build inside a markdown document). Reverted back to rST in ef33c3a

@emmanuelle
Copy link
Member

I think I found another rst/md problem but when it's resolved I'll be ready to approve this PR. If someone disagrees with using mystify, now is the time :-).

This reverts commit 3fa567c and updates include directives accordingly
@sciunto
Copy link
Member
sciunto commented Aug 11, 2020

I'm happy to switch to markdown.

@sciunto sciunto added the 📄 type: Documentation Updates, fixes and additions to documentation label Aug 11, 2020
Copy link
Member
@sciunto sciunto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I do not see any regression, looks good to me!

@emmanuelle
Copy link
Member

Cool. I'll leave the PR open for one or two more days in case someone else wants to comment, since this is an important decision to make, but to @sciunto and me this PR is ready and represents an improvement.

@rossbar do you think the problem of rst files included from an md file should be reported to the mystify team? There will be some files which we're not interested in porting to markdown, like the release notes from previous versions, and it'd be great to find a way to circumvent this problem.

@sciunto
Copy link
Member
sciunto commented Aug 11, 2020

@rossbar do you think the problem of rst files included from an md file should be reported to the mystify team? There will be some files which we're not interested in porting to markdown, like the release notes from previous versions, and it'd be great to find a way to circumvent this problem.

Would it be painful to convert them with pandoc?

@emmanuelle
Copy link
Member

Would it be painful to convert them with pandoc?

maybe not :-)

@rossbar
Copy link
Contributor Author
rossbar commented Aug 11, 2020

do you think the problem of rst files included from an md file should be reported to the mystify team?

Good idea! I've opened a new issue (linked above).

@chrisjsewell
Copy link

Hey guys 👋 @rossbar just pointed me toward this PR in executablebooks/MyST-Parser#204. As the main author of MyST I love it lol 😁 and just wanted to say if you have any questions, issues or suggestions, don't hesitate to get in touch.
Anyway, I'll get back to answering he's question!

@chrisjsewell
Copy link

Oh and its probably too late for here, but I'd note there is some work going on to create an rST to MyST converter currently here: https://github.com/mmcky/sphinxcontrib-rst2myst (but will move to executablebooks soon)

@emmanuelle
Copy link
Member

thanks @chrisjsewell ! We'll definitely ping you if needed in future conversations! I think the biggest problem we've encountered so far is that it's not possible to include a rst file within an md one, do you have any suggestions about this issue?

For now I'll be merging this PR.

@emmanuelle emmanuelle merged commit c7479c1 into scikit-image:master Aug 16, 2020
@chrisjsewell
Copy link

I think the biggest problem we've encountered so far is that it's not possible to include a rst file within an md one, do you have any suggestions about this issue?

no problem @emmanuelle, yes as discussed with @rossbar in executablebooks/MyST-Parser#204 (comment) its a work in progress 😬 But hopefully sooner than later

@chrisjsewell
Copy link

I think the biggest problem we've encountered so far is that it's not possible to include a rst file within an md one, do you have any suggestions about this issue?

This is now possible in v0.12.2 😄 https://myst-parser.readthedocs.io/en/latest/using/howto.html#include-rst-files-into-a-markdown-file

@stefanv
Copy link
Member
stefanv commented Aug 25, 2020

Fantastic, thanks @chrisjsewell!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📄 type: Documentation Updates, fixes and additions to documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants
0