Skip to content

Commit

Permalink
Merge 6214cd9 into 21d7e1e
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Mar 27, 2020
2 parents 21d7e1e + 6214cd9 commit 8b7da13
Show file tree
Hide file tree
Showing 111 changed files with 16,282 additions and 8,410 deletions.
1 change: 0 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
- cache-pip
- run: |
pip install --user -e .[sphinx,rtd]
pip install -r docs/requirements.txt
- save_cache:
key: cache-pip
paths:
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions

name: Python package

on: [push, pull_request]
# push:
# branches: [ master ]
# pull_request:
# branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[sphinx,code_style,testing]
- name: Pre-commit checks
run: |
pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
# cd tests/test_commonmark && ./spec.sh
- name: Test with pytest
run: |
pip install pytest
pytest --cov=myst_parser --cov-report=
- name: Upload to coveralls
run: |
pip install coveralls
coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_KEY }}

publish:

name: Publish to PyPi
needs: build
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: Build package
run: |
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish
uses: pypa/gh-action-pypi-publish@v1.1.0
with:
user: __token__
password: ${{ secrets.PYPI_KEY }}
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -127,3 +127,5 @@ dmypy.json

# Pyre type checker
.pyre/

_archive/
3 changes: 2 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ exclude: >
(?x)^(
\.vscode/settings\.json|
tests/test_commonmark/commonmark\.json|
.*\.xml
.*\.xml|
tests/.*/fixtures/.*\.md
)$
repos:
Expand Down
1 change: 0 additions & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ python:
extra_requirements:
- sphinx
- rtd
- requirements: docs/requirements.txt
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@
"python.linting.flake8Enabled": true,
"python.linting.enabled": true,
"autoDocstring.customTemplatePath": "docstring.fmt.mustache",
"python.pythonPath": "/anaconda/envs/ebp/bin/python"
"python.pythonPath": "/anaconda/envs/ebp/bin/python",
"restructuredtext.confPath": "${workspaceFolder}/docs"
}
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include LICENSE
include myst_parser/cli/spec.md
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# MyST-Parser

[![CI Status][travis-badge]][travis-link]
[![Github-CI][github-ci]][github-link]
[![Coverage][coveralls-badge]][coveralls-link]
[![Documentation Status][rtd-badge]][rtd-link]
[![Code style: black][black-badge]][black-link]
Expand Down Expand Up @@ -35,8 +35,8 @@ pip install -e .[sphinx,code_style,testing,rtd]

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

[travis-badge]: https://travis-ci.org/ExecutableBookProject/MyST-Parser.svg?branch=master
[travis-link]: https://travis-ci.org/ExecutableBookProject/MyST-Parser
[github-ci]: https://github.com/ExecutableBookProject/MyST-Parser/workflows/Python%20package/badge.svg?branch=master
[github-link]: https://github.com/ExecutableBookProject/MyST-Parser
[coveralls-badge]: https://coveralls.io/repos/github/ExecutableBookProject/MyST-Parser/badge.svg?branch=master
[coveralls-link]: https://coveralls.io/github/ExecutableBookProject/MyST-Parser?branch=master
[rtd-badge]: https://readthedocs.org/projects/myst-parser/badge/?version=latest
Expand Down
1 change: 0 additions & 1 deletion docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
```{toctree}
:maxdepth: 2
tokens.rst
directive.rst
renderers.rst
sphinx_parser.rst
Expand Down
70 changes: 34 additions & 36 deletions docs/api/renderers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,71 +3,69 @@
MyST Renderers
--------------

MyST-Parser builds on the mistletoe
:ref:`core renderers <mistletoe:renderers/core>`
by including the extended tokens, listed in :ref:`api/tokens`,
and adding bridges to docutils/sphinx:

HTML
....
These renderers take the markdown-it parsed token stream and convert it to
the docutils AST. The sphinx renderer is a subclass of the docutils one,
with some additional methods only available *via* sphinx
.e.g. multi-document cross-referencing.

.. autoclass:: myst_parser.html_renderer.HTMLRenderer
:special-members: __init__, __enter__, __exit__
:members: default_block_tokens, default_span_tokens
:undoc-members:
:member-order: alphabetical
:show-inheritance:

Docutils
........

JSON
....

.. autoclass:: myst_parser.json_renderer.JsonRenderer
:special-members: __init__, __enter__, __exit__
:members: default_block_tokens, default_span_tokens
.. autoclass:: myst_parser.docutils_renderer.DocutilsRenderer
:special-members: __output__, __init__
:members: render, nested_render_text, add_line_and_source_path, current_node_context
:undoc-members:
:member-order: alphabetical
:member-order: bysource
:show-inheritance:

Docutils
........

.. autoclass:: myst_parser.docutils_renderer.DocutilsRenderer
:special-members: __init__, __enter__, __exit__
:members: default_block_tokens, default_span_tokens, new_document
Sphinx
......

.. autoclass:: myst_parser.sphinx_renderer.SphinxRenderer
:special-members: __output__
:members: handle_cross_reference, render_math_block_eqno
:undoc-members:
:member-order: alphabetical
:show-inheritance:

Mocking
.......

These classes are parsed to sphinx roles and directives,
to mimic the original docutls rST specific parser elements,
but instead run nested parsing with the markdown parser.

.. autoclass:: myst_parser.docutils_renderer.MockInliner
. autoclass:: myst_parser.mocking.MockInliner
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: myst_parser.docutils_renderer.MockState
.. autoclass:: myst_parser.mocking.MockState
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: myst_parser.docutils_renderer.MockStateMachine
.. autoclass:: myst_parser.mocking.MockStateMachine
:members:
:undoc-members:
:show-inheritance:

.. autoclass:: myst_parser.docutils_renderer.MockIncludeDirective
.. autoclass:: myst_parser.mocking.MockIncludeDirective
:members:
:undoc-members:
:show-inheritance:

Sphinx
......

.. autoclass:: myst_parser.docutils_renderer.SphinxRenderer
:special-members: __init__, __enter__, __exit__
:members: default_block_tokens, default_span_tokens, mock_sphinx_env
:undoc-members:
:member-order: alphabetical
:show-inheritance:
Additional Methods
..................

.. autofunction:: myst_parser.docutils_renderer.make_document

.. autofunction:: myst_parser.docutils_renderer.dict_to_docinfo

.. autofunction:: myst_parser.sphinx_renderer.minimal_sphinx_app

.. autofunction:: myst_parser.sphinx_renderer.mock_sphinx_env
2 changes: 1 addition & 1 deletion docs/api/sphinx_parser.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Sphinx Parser
-------------

This class builds on the :py:class:`~myst_parser.docutils_renderer.SphinxRenderer`
This class builds on the :py:class:`~myst_parser.sphinx_renderer.SphinxRenderer`
to generate a parser for Sphinx, using the :ref:`Sphinx parser API <sphinx:parser-api>`:

.. autoclass:: myst_parser.sphinx_parser.MystParser
Expand Down
55 changes: 0 additions & 55 deletions docs/api/tokens.rst

This file was deleted.

2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = "pandas_sphinx_theme"
html_theme = "pydata_sphinx_theme"
html_logo = "_static/logo.png"

# Add any paths that contain custom static files (such as style sheets) here,
Expand Down
11 changes: 2 additions & 9 deletions docs/develop/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@
This page describes implementation details to help you understand the structure
of the project.

```{note}
MyST currently relies on
[a fork of the Mistletoe project](https://github.com/ExecutableBookProject/mistletoe).
We hope to upstream these changes, but in the meantime make sure that you are using
this fork.
```
## A Renderer for markdown-it tokens

## An extension to Mistletoe syntax

At a high level, the MyST parser is an extension of the Mistletoe project. Mistletoe
At a high level, the MyST parser is an extension of th project. Markdown-It-Py
is a well-structured Python parser for CommonMark text. It also defines an extension
point to include more syntax in parsed files. The MyST parser uses this extension
point to define its own syntax options (e.g., for Sphinx roles and directives).
Expand Down
6 changes: 3 additions & 3 deletions docs/develop/contributing.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

[![CI Status][travis-badge]][travis-link]
[![Github-CI][github-ci]][github-link]
[![Coverage][coveralls-badge]][coveralls-link]
[![CircleCI][circleci-badge]][circleci-link]
[![Documentation Status][rtd-badge]][rtd-link]
Expand Down Expand Up @@ -70,8 +70,8 @@ Merging pull requests: There are three ways of 'merging' pull requests on GitHub
- 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.

[travis-badge]: https://travis-ci.org/ExecutableBookProject/MyST-Parser.svg?branch=master
[travis-link]: https://travis-ci.org/ExecutableBookProject/MyST-Parser
[github-ci]: https://github.com/ExecutableBookProject/MyST-Parser/workflows/Python%20package/badge.svg?branch=master
[github-link]: https://github.com/ExecutableBookProject/MyST-Parser
[coveralls-badge]: https://coveralls.io/repos/github/ExecutableBookProject/MyST-Parser/badge.svg?branch=master
[coveralls-link]: https://coveralls.io/github/ExecutableBookProject/MyST-Parser?branch=master
[circleci-badge]: https://circleci.com/gh/ExecutableBookProject/MyST-Parser.svg?style=shield
Expand Down

0 comments on commit 8b7da13

Please sign in to comment.