Skip to content
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

Docs: Adds Myst to the getting started with sphinx #7938

Merged
merged 4 commits into from Feb 24, 2021

Conversation

Pradhvan
Copy link
Contributor

Myst is a more maintained and feature complete version of markdown for Sphinx.
Updated getting-started-with-sphinx.rst and added Myst instalation
guide under using-markdown-with-sphinx section.

Closes #7937

Myst is a more maintained and feature complete version of markdown for Sphinx.
Updated `getting-started-with-sphinx.rst` and added Myst instalation
guide under `using-markdown-with-sphinx` section.

Closes readthedocs#7937
Copy link
Member

@stsewd stsewd left a comment

Choose a reason for hiding this comment

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

Thanks! We should also link to the myst documentation.


Then in your ``conf.py``:

.. code-block:: python

extensions = ['recommonmark']
extensions = ['myst-parser']

.. warning:: Markdown doesn't support a lot of the features of Sphinx,
Copy link
Member

Choose a reason for hiding this comment

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

I think we can remove or update this warning, myst does support directives and roles.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Let me remove the warning and update the PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stsewd on second thought, I think it's best to just update the warning. As the warning also mentioned to use reStructuredText instead of markdown with a blog post. So I think it would benefit anyone waiting to write documentation but is confused between markdown and reStructuredText

* Updated warning in Using Markdown with Sphinx section to remove markup
and directive warning.

* Adds Getting Started with MyST link to External resources.
@Pradhvan Pradhvan requested a review from stsewd February 23, 2021 11:15
@@ -120,7 +116,9 @@ Here are some external resources to help you learn more about Sphinx.

* `Sphinx documentation`_
* :doc:`RestructuredText primer <sphinx:usage/restructuredtext/basics>`
* `Getting Started with MyST`_
Copy link
Member

Choose a reason for hiding this comment

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

We could move this link to the Using Markdown with Sphinx section so is easy to find. Something like You can use Markdown using MyST_

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure 👍🏾

@Pradhvan Pradhvan requested a review from stsewd February 24, 2021 08:32
Copy link
Member

@stsewd stsewd left a comment

Choose a reason for hiding this comment

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

Thanks!

docs/intro/getting-started-with-sphinx.rst Outdated Show resolved Hide resolved
@stsewd stsewd enabled auto-merge (squash) February 24, 2021 16:21
@stsewd stsewd merged commit 9d026df into readthedocs:master Feb 24, 2021
agjohnson pushed a commit that referenced this pull request Mar 2, 2021
Myst is a more maintained and feature complete version of markdown for Sphinx.
Updated `getting-started-with-sphinx.rst` and added Myst instalation
guide under `using-markdown-with-sphinx` section.

Closes #7937

Co-authored-by: Santos Gallegos <stsewd@protonmail.com>
@jivanpal
Copy link

jivanpal commented Mar 5, 2021

As a result of this PR, the docs now say:

You can use Markdown using MyST and reStructuredText in the same Sphinx project. We support this natively on Read the Docs, ...

However, trying to build a project that uses MyST on Read the Docs does not actually seem to work. Excerpts from my builds:

ModuleNotFoundError: No module named 'myst_parser'

sphinx.errors.ExtensionError: Could not import extension myst_parser (exception: No module named 'myst_parser')

Extension error:
Could not import extension myst_parser (exception: No module named 'myst_parser')

Read the Docs build numbers:

  • 13172208
  • 13172233
  • 13172309
  • 13172336
  • 13172341

Also, the name of the package is myst-parser (with hyphen), but the name of the extension is myst_parser (with underscore), so the following needs to be corrected accordingly:

Then in your conf.py:

extensions = ['myst-parser']

My documentation generates perfectly locally.

@Pradhvan
Copy link
Contributor Author

Pradhvan commented Mar 6, 2021

@jivanpal in the rst file does mention to use extensions = ['myst-parser'] in the conf.py

@jivanpal
Copy link

jivanpal commented Mar 6, 2021

@Pradhvan I am using extensions = ['myst_parser'] as is actually required; see the MyST documentation. Attempting to use extensions = ['myst-parser'] instead and then build on Read the Docs causes a similar error (see mentioned build 13172336), and also causes generation to fail locally, because myst-parser is not the name of the extension.

@Pradhvan
Copy link
Contributor Author

Pradhvan commented Mar 6, 2021

@jivanpal created a PR #7991 Thank you ❤️

@jivanpal
Copy link

jivanpal commented Mar 10, 2021

However, trying to build a project that uses MyST on Read the Docs does not actually seem to work.

Turns out that I needed to specify myst-parser as a dependency. From the phrase "We support this natively on Read the Docs", I thought Read the Docs would already have the package installed, or otherwise detect the dependency, but this is clearly not the case. This necessity isn't mentioned in intro/getting-started-with-sphinx where MyST is mentioned, so if this were mentioned with a link to e.g. guides/reproducible-builds, I think this would avoid MyST users from having this problem in future.

My project is now building successfully on Read the Docs. 😁  For anyone who comes across this comment in the same situation, I achieved this by creating a /.readthedocs.yml and /docs/requirements.txt in my repo, specifying myst-parser in the latter.

# /.readthedocs.yml

version: 2

sphinx:
  configuration: docs/conf.py

python:
  version: 3.8
  install:
    - requirements: docs/requirements.txt
# /docs/requirements.txt

sphinx==3.5.1
sphinx_rtd_theme==0.5.1
myst-parser==0.13.5

@stsewd
Copy link
Member

stsewd commented Mar 10, 2021

Turns out that I needed to specify myst-parser as a dependency. From the phrase "We support this natively on Read the Docs", I thought Read the Docs would already have the package installed

Yeah, we should make that more clear, maybe remove that wording and put an example of the config/requirements file

@Pradhvan
Copy link
Contributor Author

@stsewd I can draft a different PR for this weekend. 😄

Yeah, we should make that more clear, maybe remove that wording and put an example of the config/requirements file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update getting started docs to point to Myst instead of recommonmark
3 participants