Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/test-formats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -43,10 +43,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ jobs:

steps:
- uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- uses: pre-commit/action@v3.0.1

tests:

strategy:
fail-fast: false
matrix:
python-version: ["3.10", "3.11", "3.12", "3.13"]
sphinx: [">=8,<8.2"]
python-version: ["3.11", "3.12", "3.13"]
sphinx: [">=8,<9"]
os: [ubuntu-latest]
include:
- os: ubuntu-latest
python-version: "3.10"
sphinx: ">=7,<8"
# - os: ubuntu-latest
# python-version: "3.11"
# sphinx: ">=7,<8"
- os: windows-latest
python-version: "3.10"
sphinx: ">=7,<8"
python-version: "3.11"
sphinx: ">=8,<9"

runs-on: ${{ matrix.os }}

Expand All @@ -56,7 +56,7 @@ jobs:
pytest --cov=myst_parser --cov-report=xml --cov-report=term-missing
coverage xml
- name: Upload to Codecov
if: github.repository == 'executablebooks/MyST-Parser' && matrix.python-version == 3.10 && matrix.os == 'ubuntu-latest'
if: github.repository == 'executablebooks/MyST-Parser' && matrix.python-version == 3.11 && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand All @@ -78,10 +78,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- name: Install setup
run: |
python -m pip install --upgrade pip
Expand Down Expand Up @@ -133,10 +133,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- name: install flit
run: |
pip install flit~=3.4
Expand All @@ -156,10 +156,10 @@ jobs:
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python 3.10
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
- name: install flit and tomlkit
run: |
pip install flit~=3.4 tomlkit
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ repos:
args: [--config-file=pyproject.toml]
additional_dependencies:
- types-urllib3
- sphinx~=7.4
- sphinx~=8.2
- markdown-it-py~=3.0
- mdit-py-plugins~=0.4.0
files: >
Expand Down
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.10"
python: "3.11"

python:
install:
Expand Down
2 changes: 1 addition & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
suppress_warnings = ["myst.strikethrough"]

intersphinx_mapping = {
"python": ("https://docs.python.org/3.10", None),
"python": ("https://docs.python.org/3.11", None),
"sphinx": ("https://www.sphinx-doc.org/en/master", None),
"markdown_it": ("https://markdown-it-py.readthedocs.io/en/latest", None),
}
Expand Down
2 changes: 1 addition & 1 deletion myst_parser/inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def to_sphinx(inv: InventoryType) -> SphinxInventoryType:
for domain_name, obj_types in inv["objects"].items():
for obj_type, refs in obj_types.items():
for refname, refdata in refs.items():
objs.setdefault(f"{domain_name}:{obj_type}", {})[refname] = (
objs.setdefault(f"{domain_name}:{obj_type}", {})[refname] = ( # type: ignore[assignment]
inv["name"],
inv["version"],
refdata["loc"],
Expand Down
10 changes: 0 additions & 10 deletions myst_parser/sphinx_ext/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from typing import Any

import sphinx
from docutils import nodes
from sphinx.application import Sphinx
from sphinx.transforms import (
Expand All @@ -12,9 +11,7 @@
from myst_parser.mdit_to_docutils.transforms import UnreferencedFootnotesDetector
from myst_parser.parsers.docutils_ import (
depart_container_html,
depart_rubric_html,
visit_container_html,
visit_rubric_html,
)
from myst_parser.warnings_ import MystWarnings

Expand Down Expand Up @@ -51,13 +48,6 @@ def setup_sphinx(app: Sphinx, load_parser: bool = False) -> None:

app.add_post_transform(MystReferenceResolver)

# override only the html writer visit methods for rubric, to use the "level" attribute
# this allows for nested headers to be correctly rendered
if sphinx.version_info < (7, 4):
# This is now added in sphinx: https://github.com/sphinx-doc/sphinx/pull/12506
app.add_node(
nodes.rubric, override=True, html=(visit_rubric_html, depart_rubric_html)
)
# override only the html writer visit methods for container,
# to remove the "container" class for divs
# this avoids CSS clashes with the bootstrap theme
Expand Down
7 changes: 3 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
Expand All @@ -32,14 +31,14 @@ keywords = [
"docutils",
"sphinx",
]
requires-python = ">=3.10"
requires-python = ">=3.11"
dependencies = [
"docutils>=0.19,<0.22",
"jinja2", # required for substitutions, but let sphinx choose version
"markdown-it-py~=3.0",
"mdit-py-plugins~=0.4,>=0.4.1",
"pyyaml",
"sphinx>=7,<9",
"sphinx>=8,<9",
]

[project.urls]
Expand All @@ -52,7 +51,7 @@ code_style = ["pre-commit~=4.0"]
linkify = ["linkify-it-py~=2.0"]
# Note: This is only required for internal use
rtd = [
"sphinx>=7",
"sphinx>=8",
"ipython",
"sphinx-book-theme~=1.1",
"sphinx-design",
Expand Down
12 changes: 6 additions & 6 deletions tests/test_renderers/fixtures/sphinx_directives.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object (`sphinx.directives.ObjectDescription`):
.
<document source="<src>/index.md">
<index entries="">
<desc classes="object" desctype="object" domain="" nocontentsentry="False" noindex="False" noindexentry="False" objtype="object">
<desc classes="object" desctype="object" domain="" no-contents-entry="False" no-index="False" no-index-entry="False" no-typesetting="False" nocontentsentry="False" noindex="False" noindexentry="False" objtype="object">
<desc_signature _toc_name="" _toc_parts="()" classes="sig sig-object">
<desc_name classes="sig-name descname" xml:space="preserve">
something
Expand Down Expand Up @@ -323,7 +323,7 @@ math (`sphinx.directives.patches.MathDirective`):
```
.
<document source="<src>/index.md">
<math_block docname="index" label="True" nowrap="False" number="True" xml:space="preserve">
<math_block docname="index" label="True" no-wrap="False" nowrap="False" number="True" xml:space="preserve">
.

deprecated (`sphinx.domains.changeset.VersionChange`):
Expand All @@ -347,7 +347,7 @@ versionadded (`sphinx.domains.changeset.VersionChange`):
<versionmodified type="versionadded" version="0.2">
<paragraph translatable="False">
<inline classes="versionmodified added">
New in version 0.2.
Added in version 0.2.
.

versionchanged (`sphinx.domains.changeset.VersionChange`):
Expand All @@ -372,7 +372,7 @@ term 2 : B
```
.
<document source="<src>/index.md">
<glossary>
<glossary sorted="False">
<definition_list classes="glossary">
<definition_list_item>
<term ids="term-term-1">
Expand Down Expand Up @@ -404,7 +404,7 @@ cmdoption (`sphinx.domains.std.Cmdoption`):
.
<document source="<src>/index.md">
<index entries="('pair',\ 'command\ line\ option;\ a',\ 'cmdoption-arg-a',\ '',\ None)">
<desc classes="std cmdoption" desctype="cmdoption" domain="std" nocontentsentry="False" noindex="False" noindexentry="False" objtype="cmdoption">
<desc classes="std cmdoption" desctype="cmdoption" domain="std" no-contents-entry="False" no-index="False" no-index-entry="False" no-typesetting="False" nocontentsentry="False" noindex="False" noindexentry="False" objtype="cmdoption">
<desc_signature _toc_name="" _toc_parts="()" allnames="a" classes="sig sig-object" ids="cmdoption-arg-a">
<desc_name classes="sig-name descname" xml:space="preserve">
a
Expand All @@ -419,7 +419,7 @@ rst:directive (`sphinx.domains.rst.ReSTDirective`):
.
<document source="<src>/index.md">
<index entries="('single',\ 'a\ (directive)',\ 'directive-a',\ '',\ None)">
<desc classes="rst directive" desctype="directive" domain="rst" nocontentsentry="False" noindex="False" noindexentry="False" objtype="directive">
<desc classes="rst directive" desctype="directive" domain="rst" no-contents-entry="False" no-index="False" no-index-entry="False" no-typesetting="False" nocontentsentry="False" noindex="False" noindexentry="False" objtype="directive">
<desc_signature _toc_name=".. a::" _toc_parts="('a',)" classes="sig sig-object" fullname="a" ids="directive-a">
<desc_name classes="sig-name descname" xml:space="preserve">
.. a::
Expand Down
24 changes: 0 additions & 24 deletions tests/test_renderers/test_fixtures_sphinx.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,9 @@ def test_sphinx_directives(

sphinx_doctree_no_tr.set_conf({"extensions": ["myst_parser"]})
pformat = sphinx_doctree_no_tr(file_params.content, "index.md").pformat("index")
# see https://github.com/sphinx-doc/sphinx/issues/9827
pformat = pformat.replace('<glossary sorted="False">', "<glossary>")
# see https://github.com/executablebooks/MyST-Parser/issues/522
if sys.maxsize == 2147483647:
pformat = pformat.replace('"2147483647"', '"9223372036854775807"')
# changed in sphinx 7.1 (but fixed in 7.2)
pformat = pformat.replace(
'classes="sig sig-object sig sig-object"', 'classes="sig sig-object"'
)
pformat = pformat.replace(
'classes="sig-name descname sig-name descname"', 'classes="sig-name descname"'
)
pformat = pformat.replace(
'classes="sig-prename descclassname sig-prename descclassname"',
'classes="sig-prename descclassname"',
)
# changed in sphinx 7.2 (#11533)
pformat = pformat.replace(
(
'no-contents-entry="False" no-index="False" '
'no-index-entry="False" no-typesetting="False" '
),
"",
)
# changed in sphinx 7.3
pformat = pformat.replace("Added in version 0.2", "New in version 0.2")

file_params.assert_expected(pformat, rstrip_lines=True)


Expand Down
2 changes: 0 additions & 2 deletions tests/test_sphinx/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,6 @@ def read(
for clearer_div in doc_div.findAll("div", {"class": "clearer"}):
clearer_div.decompose()
text = doc_div.prettify()
# changed in sphinx 7.2
text = text.replace('"Link to this', '"Permalink to this')
for find, rep in (replace or {}).items():
text = text.replace(find, rep)
file_regression.check(text, extension=regress_ext, encoding="utf8")
Expand Down
Loading