Skip to main content

An extended commonmark compliant parser, with bridges to docutils & sphinx.

Reason this release was yanked:

no sphinx pinning

Project description

MyST-Parser

CI Status Coverage Documentation Status Code style: black PyPI

An extended commonmark compliant parser, with bridges to docutils & sphinx.

Usage

pip install myst-parser[sphinx]

Or for package development:

git clone https://github.com/ExecutableBookProject/MyST-Parser
cd MyST-Parser
git checkout master
pip install -e .[sphinx,code_style,testing,rtd]

To use the MyST parser in Sphinx, simply add: extensions = ["myst_parser"] to your conf.py.

Parsed Token Classes

For more information, also see the CommonMark Spec.

Block Tokens

  • FrontMatter: A YAML block at the start of the document enclosed by ---
  • HTMLBlock: Any valid HTML (rendered in HTML output only)
  • LineComment: % this is a comment
  • BlockCode: indented text (4 spaces)
  • Heading: # Heading (levels 1-6)
  • SetextHeading: underlined header
  • Quote: > this is a quote
  • CodeFence: enclosed in 3 or more backticks. If it starts with a {name}, then treated as directive.
  • ThematicBreak: ---
  • List: bullet points or enumerated.
  • Table: Standard markdown table styles.
  • Footnote: A substitution for an inline link (e.g. [key][name]), which can have a reference target (no spaces), and an optional title (in "), e.g. [key]: https://www.google.com "a title"
  • Paragraph: General inline text

Span (Inline) Tokens

  • Role: `{name}`interpreted text`
  • Math: $a=1$ or $$a=1$$
  • HTMLSpan: any valid HTML (rendered in HTML output only)
  • EscapeSequence: \*
  • AutoLink: <http://www.google.com>
  • Target: (target)= (precedes element to target, e.g. header)
  • InlineCode: `a=1`
  • LineBreak: Soft or hard (ends with spaces or \)
  • Image: ![alt](src "title")
  • Link: [text](target "title") or [text][key] (key from Footnote)
  • Strong: **strong**
  • Emphasis: *emphasis*
  • RawText

Contributing

Code Style

Code style is tested using flake8, with the configuration set in .flake8, and code formatted with black.

Installing with myst-parser[code_style] makes the pre-commit package available, which will ensure this style is met before commits are submitted, by reformatting the code and testing for lint errors. It can be setup by:

>> cd MyST-Parser
>> pre-commit install

Optionally you can run black and flake8 separately:

>> black .
>> flake8 .

Editors like VS Code also have automatic code reformat utilities, which can adhere to this standard.

Pull Requests

To contribute, make Pull Requests to the master branch (this is the default branch). A PR can consist of one or multiple commits. Before you open a PR, make sure to clean up your commit history and create the commits that you think best divide up the total work as outlined above (use git rebase and git commit --amend). Ensure all commit messages clearly summarise the changes in the header and the problem that this commit is solving in the body.

Merging pull requests: There are three ways of 'merging' pull requests on GitHub:

  • Squash and merge: take all commits, squash them into a single one and put it on top of the base branch. Choose this for pull requests that address a single issue and are well represented by a single commit. Make sure to clean the commit message (title & body)
  • Rebase and merge: take all commits and 'recreate' them on top of the base branch. All commits will be recreated with new hashes. Choose this for pull requests that require more than a single commit. Examples: PRs that contain multiple commits with individually significant changes; PRs that have commits from different authors (squashing commits would remove attribution)
  • Merge with merge commit: put all commits as they are on the base branch, with a merge commit on top Choose for collaborative PRs with many commits. Here, the merge commit provides actual benefits.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

myst-parser-0.3.2.tar.gz (30.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

myst_parser-0.3.2-py3-none-any.whl (31.9 kB view details)

Uploaded Python 3

File details

Details for the file myst-parser-0.3.2.tar.gz.

File metadata

  • Download URL: myst-parser-0.3.2.tar.gz
  • Upload date:
  • Size: 30.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.1

File hashes

Hashes for myst-parser-0.3.2.tar.gz
Algorithm Hash digest
SHA256 70c15370f1d53aa0090efdf22ce1c6be810ce22806251cd0481b59a4657004e6
MD5 fd3b984d312c8567eacbe0ff2b28a2e1
BLAKE2b-256 4fb2ff45af14fe36a7836bc36cd9450f70dd6af81476844fc179148c99ab5975

See more details on using hashes here.

File details

Details for the file myst_parser-0.3.2-py3-none-any.whl.

File metadata

  • Download URL: myst_parser-0.3.2-py3-none-any.whl
  • Upload date:
  • Size: 31.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.1

File hashes

Hashes for myst_parser-0.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 332888c64121e825f6b3526a4a3e475b1cfb9e8cd144686ea7374d7a16dde11f
MD5 6f06445d048876f311b807c5d86568a9
BLAKE2b-256 78064b48e35e18128be9e645264db1021a7b646b02f1f4c39c9365bb65c2708f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page