doc8-inline-markup 2026.11.18.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. doc8_inline_markup-2026.11.18.3/.gitattributes +1 -0
  2. doc8_inline_markup-2026.11.18.3/.github/dependabot.yml +19 -0
  3. doc8_inline_markup-2026.11.18.3/.github/workflows/ci.yml +49 -0
  4. doc8_inline_markup-2026.11.18.3/.github/workflows/lint.yml +57 -0
  5. doc8_inline_markup-2026.11.18.3/.github/workflows/release.yml +55 -0
  6. doc8_inline_markup-2026.11.18.3/.gitignore +11 -0
  7. doc8_inline_markup-2026.11.18.3/LICENSE +21 -0
  8. doc8_inline_markup-2026.11.18.3/MANIFEST.in +2 -0
  9. doc8_inline_markup-2026.11.18.3/PKG-INFO +59 -0
  10. doc8_inline_markup-2026.11.18.3/README.rst +34 -0
  11. doc8_inline_markup-2026.11.18.3/prek.toml +165 -0
  12. doc8_inline_markup-2026.11.18.3/pyproject.toml +120 -0
  13. doc8_inline_markup-2026.11.18.3/setup.cfg +4 -0
  14. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup/__init__.py +1 -0
  15. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup/_doc8.py +36 -0
  16. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup/_rst.py +99 -0
  17. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup/py.typed +0 -0
  18. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup.egg-info/PKG-INFO +59 -0
  19. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup.egg-info/SOURCES.txt +27 -0
  20. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup.egg-info/dependency_links.txt +1 -0
  21. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup.egg-info/entry_points.txt +2 -0
  22. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup.egg-info/not-zip-safe +1 -0
  23. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup.egg-info/requires.txt +2 -0
  24. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup.egg-info/scm_file_list.json +22 -0
  25. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup.egg-info/scm_version.json +8 -0
  26. doc8_inline_markup-2026.11.18.3/src/doc8_inline_markup.egg-info/top_level.txt +1 -0
  27. doc8_inline_markup-2026.11.18.3/tests/__init__.py +1 -0
  28. doc8_inline_markup-2026.11.18.3/tests/test_doc8.py +53 -0
  29. doc8_inline_markup-2026.11.18.3/tests/test_lint.py +46 -0
@@ -0,0 +1 @@
1
+ * text=auto eol=lf
@@ -0,0 +1,19 @@
1
+ ---
2
+ version: 2
3
+
4
+ updates:
5
+ - package-ecosystem: pip
6
+ allow:
7
+ - dependency-type: all
8
+ directory: /
9
+ schedule:
10
+ interval: daily
11
+ open-pull-requests-limit: 10
12
+ - package-ecosystem: github-actions
13
+ directory: /
14
+ schedule:
15
+ interval: daily
16
+ open-pull-requests-limit: 10
17
+
18
+ # Dependabot cannot read prek.toml yet:
19
+ # https://github.com/dependabot/dependabot-core/issues/14624
@@ -0,0 +1,49 @@
1
+ ---
2
+ name: Test
3
+
4
+ on:
5
+ push:
6
+ branches: [main]
7
+ pull_request: {}
8
+ schedule:
9
+ # * is a special character in YAML so you have to quote this string
10
+ # Run at 1:00 every day
11
+ - cron: 0 1 * * *
12
+
13
+ permissions: {}
14
+
15
+ jobs:
16
+ build:
17
+ strategy:
18
+ matrix:
19
+ python-version: ['3.12', '3.13', '3.14', '3.15']
20
+ platform: [ubuntu-latest, windows-latest]
21
+
22
+ runs-on: ${{ matrix.platform }}
23
+
24
+ steps:
25
+ - uses: actions/checkout@v7
26
+
27
+ with:
28
+ persist-credentials: false
29
+ - name: Install uv
30
+ uses: astral-sh/setup-uv@v10.3.3
31
+ with:
32
+ enable-cache: true
33
+ cache-dependency-glob: '**/pyproject.toml'
34
+
35
+ - name: Run tests
36
+ shell: bash
37
+ run: uv run --group=dev --python=${{ matrix.python-version }} pytest -vv --cov
38
+
39
+ completion-ci:
40
+ needs: build
41
+ runs-on: ubuntu-latest
42
+ if: ${{ !cancelled() }} # Run even if one matrix job fails
43
+ steps:
44
+ - name: Check matrix job status
45
+ run: |-
46
+ if ! ${{ needs.build.result == 'success' }}; then
47
+ echo "One or more matrix jobs failed"
48
+ exit 1
49
+ fi
@@ -0,0 +1,57 @@
1
+ ---
2
+ name: Lint
3
+
4
+ on:
5
+ push:
6
+ branches: [main]
7
+ pull_request: {}
8
+ schedule:
9
+ # * is a special character in YAML so you have to quote this string
10
+ # Run at 1:00 every day
11
+ - cron: 0 1 * * *
12
+ workflow_dispatch: {}
13
+
14
+ permissions: {}
15
+
16
+ jobs:
17
+ build:
18
+ strategy:
19
+ matrix:
20
+ python-version: ['3.13']
21
+ platform: [ubuntu-latest, windows-latest]
22
+ hook-stage: [pre-commit, pre-push, manual]
23
+
24
+ runs-on: ${{ matrix.platform }}
25
+
26
+ steps:
27
+ - uses: actions/checkout@v7
28
+ with:
29
+ persist-credentials: false
30
+
31
+ - name: Install uv
32
+ uses: astral-sh/setup-uv@v10.3.3
33
+ with:
34
+ enable-cache: true
35
+ cache-dependency-glob: '**/pyproject.toml'
36
+
37
+ - name: Lint
38
+ uses: j178/prek-action@v3.1.0
39
+ with:
40
+ prek-version: 0.5.10
41
+ extra-args: >-
42
+ --all-files --hook-stage ${{ matrix.hook-stage }} --verbose
43
+ env:
44
+ UV_NO_CACHE: '1'
45
+ UV_PYTHON: ${{ matrix.python-version }}
46
+
47
+ completion-lint:
48
+ needs: build
49
+ runs-on: ubuntu-latest
50
+ if: ${{ !cancelled() }}
51
+ steps:
52
+ - name: Check matrix job status
53
+ run: |-
54
+ if ! ${{ needs.build.result == 'success' }}; then
55
+ echo "One or more matrix jobs failed"
56
+ exit 1
57
+ fi
@@ -0,0 +1,55 @@
1
+ ---
2
+ name: Release
3
+
4
+ on:
5
+ push:
6
+ tags: ['[0-9]*']
7
+
8
+ permissions: {}
9
+
10
+ jobs:
11
+ release:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write
15
+ steps:
16
+ - uses: actions/checkout@v7
17
+ with:
18
+ fetch-depth: 0
19
+ persist-credentials: false
20
+
21
+ - uses: astral-sh/setup-uv@v10.3.3
22
+
23
+ - name: Build and check distributions
24
+ run: |
25
+ uv build
26
+ uv run --group=release check-wheel-contents dist/*.whl
27
+ uv run --group=release twine check --strict dist/*
28
+
29
+ - uses: actions/upload-artifact@v7.0.2
30
+ with:
31
+ name: distributions
32
+ path: dist/
33
+ if-no-files-found: error
34
+
35
+ - name: Create a GitHub release
36
+ env:
37
+ GH_TOKEN: ${{ github.token }}
38
+ RELEASE_TAG: ${{ github.ref_name }}
39
+ run: gh release create "$RELEASE_TAG" --verify-tag --generate-notes dist/*
40
+
41
+ publish-pypi:
42
+ needs: release
43
+ runs-on: ubuntu-latest
44
+ environment:
45
+ name: pypi
46
+ url: https://pypi.org/project/doc8-inline-markup/
47
+ permissions:
48
+ id-token: write
49
+ steps:
50
+ - uses: actions/download-artifact@v8.0.2
51
+ with:
52
+ name: distributions
53
+ path: dist/
54
+
55
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ .venv-*/
3
+ __pycache__/
4
+ *.egg-info/
5
+ .coverage
6
+ .mypy_cache/
7
+ .pytest_cache/
8
+ .ruff_cache/
9
+ build/
10
+ dist/
11
+ uv.lock
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Adam Dangoor
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,2 @@
1
+ include prek.toml
2
+ recursive-include tests *.py
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: doc8-inline-markup
3
+ Version: 2026.11.18.3
4
+ Summary: A doc8 plugin for inline literals inside reStructuredText emphasis.
5
+ Author-email: Adam Dangoor <adamdangoor@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Source, https://github.com/adamtheturtle/doc8-inline-markup
8
+ Keywords: doc8,restructuredtext
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Operating System :: Microsoft :: Windows
12
+ Classifier: Operating System :: POSIX
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: 3.15
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/x-rst
21
+ License-File: LICENSE
22
+ Requires-Dist: doc8<3,>=2
23
+ Requires-Dist: docutils<0.24,>=0.21
24
+ Dynamic: license-file
25
+
26
+ doc8 Inline Markup
27
+ ==================
28
+
29
+ A doc8 plugin that detects inline literals inside bold or italic
30
+ reStructuredText. Docutils treats the inner backticks as text, which
31
+ makes the code render with visible backticks. The check reports RST001.
32
+
33
+ For example, change this note::
34
+
35
+ .. note:: **``event_id`` deduplication**
36
+
37
+ to::
38
+
39
+ .. note:: ``event_id`` deduplication
40
+
41
+ Installation
42
+ ------------
43
+
44
+ Install the plugin in the same environment as doc8. For a uv project,
45
+ add it as a development dependency::
46
+
47
+ uv add --dev doc8-inline-markup
48
+
49
+ Run doc8 as usual::
50
+
51
+ uv run doc8 docs/guide.rst
52
+
53
+ doc8 discovers the plugin automatically. It checks .rst files, skips code
54
+ blocks and comments, and supports doc8's standard ignore settings. Run doc8
55
+ on included files directly. Content in extension directives that Docutils
56
+ cannot parse is outside the check's scope.
57
+
58
+ If you used rst-inline-markup-lint, replace that dependency with
59
+ doc8-inline-markup and remove any standalone hook entry for the old package.
@@ -0,0 +1,34 @@
1
+ doc8 Inline Markup
2
+ ==================
3
+
4
+ A doc8 plugin that detects inline literals inside bold or italic
5
+ reStructuredText. Docutils treats the inner backticks as text, which
6
+ makes the code render with visible backticks. The check reports RST001.
7
+
8
+ For example, change this note::
9
+
10
+ .. note:: **``event_id`` deduplication**
11
+
12
+ to::
13
+
14
+ .. note:: ``event_id`` deduplication
15
+
16
+ Installation
17
+ ------------
18
+
19
+ Install the plugin in the same environment as doc8. For a uv project,
20
+ add it as a development dependency::
21
+
22
+ uv add --dev doc8-inline-markup
23
+
24
+ Run doc8 as usual::
25
+
26
+ uv run doc8 docs/guide.rst
27
+
28
+ doc8 discovers the plugin automatically. It checks .rst files, skips code
29
+ blocks and comments, and supports doc8's standard ignore settings. Run doc8
30
+ on included files directly. Content in extension directives that Docutils
31
+ cannot parse is outside the check's scope.
32
+
33
+ If you used rst-inline-markup-lint, replace that dependency with
34
+ doc8-inline-markup and remove any standalone hook entry for the old package.
@@ -0,0 +1,165 @@
1
+ # Configuration file for `prek`, a git hook framework written in Rust.
2
+ # See https://prek.j178.dev for more information.
3
+ #:schema https://www.schemastore.org/prek.json
4
+
5
+ fail_fast = true
6
+ default_install_hook_types = [
7
+ "pre-commit",
8
+ "pre-push"
9
+ ]
10
+
11
+ [[repos]]
12
+ repo = "meta"
13
+ hooks = [
14
+ {
15
+ id = "check-useless-excludes",
16
+ stages = ["pre-commit"]
17
+ }
18
+ ]
19
+
20
+ [[repos]]
21
+ repo = "https://github.com/pre-commit/pre-commit-hooks"
22
+ rev = "v6.0.0"
23
+ hooks = [
24
+ {
25
+ id = "check-added-large-files",
26
+ stages = ["pre-commit"]
27
+ },
28
+ {
29
+ id = "check-case-conflict",
30
+ stages = ["pre-commit"]
31
+ },
32
+ {
33
+ id = "check-executables-have-shebangs",
34
+ stages = ["pre-commit"]
35
+ },
36
+ {
37
+ id = "check-merge-conflict",
38
+ stages = ["pre-commit"]
39
+ },
40
+ {
41
+ id = "check-shebang-scripts-are-executable",
42
+ stages = ["pre-commit"]
43
+ },
44
+ {
45
+ id = "check-symlinks",
46
+ stages = ["pre-commit"]
47
+ },
48
+ {
49
+ id = "check-json",
50
+ stages = ["pre-commit"]
51
+ },
52
+ {
53
+ id = "check-toml",
54
+ stages = ["pre-commit"]
55
+ },
56
+ {
57
+ id = "check-vcs-permalinks",
58
+ stages = ["pre-commit"]
59
+ },
60
+ {
61
+ id = "check-yaml",
62
+ stages = ["pre-commit"]
63
+ },
64
+ {
65
+ id = "end-of-file-fixer",
66
+ stages = ["pre-commit"]
67
+ },
68
+ {
69
+ id = "trailing-whitespace",
70
+ stages = ["pre-commit"]
71
+ }
72
+ ]
73
+
74
+ [[repos]]
75
+ repo = "https://github.com/pre-commit/pygrep-hooks"
76
+ rev = "v1.10.0"
77
+ hooks = [
78
+ {
79
+ id = "rst-directive-colons",
80
+ stages = ["pre-commit"]
81
+ },
82
+ {
83
+ id = "rst-inline-touching-normal",
84
+ stages = ["pre-commit"]
85
+ },
86
+ {
87
+ id = "text-unicode-replacement-char",
88
+ stages = ["pre-commit"]
89
+ },
90
+ {
91
+ id = "rst-backticks",
92
+ stages = ["pre-commit"]
93
+ }
94
+ ]
95
+
96
+
97
+ [[repos]]
98
+ repo = "local"
99
+ hooks = [
100
+ {
101
+ id = "actionlint",
102
+ name = "actionlint",
103
+ entry = "uv run --group=dev actionlint",
104
+ language = "system",
105
+ files = '^\.github/workflows/.*\.ya?ml$',
106
+ stages = ["pre-commit"]
107
+ },
108
+ {
109
+ id = "ruff-check",
110
+ name = "ruff check",
111
+ entry = "uv run --group=dev ruff check --fix",
112
+ language = "system",
113
+ types = ["python"],
114
+ stages = ["pre-commit"]
115
+ },
116
+ {
117
+ id = "ruff-format",
118
+ name = "ruff format",
119
+ entry = "uv run --group=dev ruff format",
120
+ language = "system",
121
+ types = ["python"],
122
+ stages = ["pre-commit"]
123
+ },
124
+ {
125
+ id = "pyproject-fmt",
126
+ name = "pyproject-fmt",
127
+ entry = "uv run --group=dev pyproject-fmt",
128
+ language = "system",
129
+ files = '^pyproject\.toml$',
130
+ stages = ["pre-commit"]
131
+ },
132
+ {
133
+ id = "mypy",
134
+ name = "mypy",
135
+ entry = "uv run --group=dev mypy",
136
+ language = "system",
137
+ types = ["python"],
138
+ pass_filenames = false,
139
+ stages = ["pre-push"]
140
+ },
141
+ {
142
+ id = "doc8",
143
+ name = "doc8",
144
+ entry = "uv run --group=dev doc8",
145
+ language = "system",
146
+ types = ["rst"],
147
+ stages = ["pre-push"]
148
+ },
149
+ {
150
+ id = "sphinx-lint",
151
+ name = "sphinx-lint",
152
+ entry = "uv run --group=dev sphinx-lint --enable=all --disable=line-too-long",
153
+ language = "system",
154
+ types = ["rst"],
155
+ stages = ["pre-push"]
156
+ },
157
+ {
158
+ id = "check-manifest",
159
+ name = "check-manifest",
160
+ entry = "uv run --group=dev check-manifest",
161
+ language = "system",
162
+ pass_filenames = false,
163
+ stages = ["manual"]
164
+ }
165
+ ]
@@ -0,0 +1,120 @@
1
+ [build-system]
2
+ build-backend = "setuptools.build_meta"
3
+ requires = [
4
+ "setuptools",
5
+ "setuptools-scm>=8.1.0",
6
+ ]
7
+
8
+ [project]
9
+ name = "doc8-inline-markup"
10
+ description = "A doc8 plugin for inline literals inside reStructuredText emphasis."
11
+ readme = { file = "README.rst", content-type = "text/x-rst" }
12
+ keywords = [
13
+ "doc8",
14
+ "restructuredtext",
15
+ ]
16
+ license = "MIT"
17
+ authors = [
18
+ { name = "Adam Dangoor", email = "adamdangoor@gmail.com" },
19
+ ]
20
+ requires-python = ">=3.12"
21
+ classifiers = [
22
+ "Development Status :: 3 - Alpha",
23
+ "Environment :: Console",
24
+ "Operating System :: Microsoft :: Windows",
25
+ "Operating System :: POSIX",
26
+ "Programming Language :: Python :: 3 :: Only",
27
+ "Programming Language :: Python :: 3.12",
28
+ "Programming Language :: Python :: 3.13",
29
+ "Programming Language :: Python :: 3.14",
30
+ "Programming Language :: Python :: 3.15",
31
+ "Topic :: Software Development :: Quality Assurance",
32
+ ]
33
+ dynamic = [
34
+ "version",
35
+ ]
36
+ dependencies = [
37
+ "doc8>=2,<3",
38
+ "docutils>=0.21,<0.24",
39
+ ]
40
+ urls.Source = "https://github.com/adamtheturtle/doc8-inline-markup"
41
+ entry-points."doc8.extension.check".doc8-inline-markup = "doc8_inline_markup._doc8:CheckInlineMarkup"
42
+
43
+ [dependency-groups]
44
+ dev = [
45
+ "actionlint-py==1.7.12.25",
46
+ "check-manifest==0.51",
47
+ "doc8==2.0.0",
48
+ "mypy==2.4.1",
49
+ "prek==0.5.10",
50
+ "pyproject-fmt==2.30.6",
51
+ "pytest==9.2.0",
52
+ "pytest-cov==7.1.0",
53
+ "ruff==0.17.5",
54
+ "shellcheck-py==0.11.0.1",
55
+ "sphinx-lint==1.0.2",
56
+ "types-docutils==0.23.0.20261107",
57
+ ]
58
+ release = [
59
+ "check-wheel-contents==0.6.3",
60
+ "twine>=6.2",
61
+ ]
62
+
63
+ [tool.setuptools]
64
+ packages.find.where = [
65
+ "src",
66
+ ]
67
+ package-data.doc8_inline_markup = [
68
+ "py.typed",
69
+ ]
70
+ zip-safe = false
71
+
72
+ [tool.setuptools_scm]
73
+ version_scheme = "post-release"
74
+
75
+ [tool.ruff]
76
+ line-length = 79
77
+ lint.select = [
78
+ "ALL",
79
+ ]
80
+ lint.ignore = [
81
+ "COM812",
82
+ "CPY001",
83
+ "D205",
84
+ "ISC001",
85
+ "S101",
86
+ ]
87
+ lint.per-file-ignores."tests/*.py" = [
88
+ "PLR2004",
89
+ "S603",
90
+ ]
91
+ lint.pydocstyle.convention = "google"
92
+
93
+ [tool.pyproject-fmt]
94
+ indent = 4
95
+ keep_full_version = true
96
+ max_supported_python = "3.15"
97
+
98
+ [tool.mypy]
99
+ files = [
100
+ "src",
101
+ "tests",
102
+ ]
103
+ strict = true
104
+ overrides = [ { module = [ "doc8.checks", "doc8.parser" ], follow_untyped_imports = true } ]
105
+
106
+ [tool.pytest]
107
+ strict = true
108
+
109
+ [tool.coverage]
110
+ run.source = [
111
+ "src/",
112
+ "tests/",
113
+ ]
114
+ run.branch = true
115
+ run.patch = [ "subprocess" ]
116
+ report.fail_under = 100
117
+ report.exclude_also = [
118
+ "if TYPE_CHECKING:",
119
+ ]
120
+ report.show_missing = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1 @@
1
+ """A doc8 plugin for nested reStructuredText inline markup."""
@@ -0,0 +1,36 @@
1
+ """Expose the inline-markup check to doc8."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING, override
6
+
7
+ from doc8.checks import ContentCheck
8
+
9
+ from doc8_inline_markup._rst import lint
10
+
11
+ if TYPE_CHECKING:
12
+ from collections.abc import Iterator
13
+
14
+ from doc8.parser import ParsedFile
15
+
16
+
17
+ _DIAGNOSTIC_CODE = "RST001"
18
+ _DIAGNOSTIC_MESSAGE = "Move inline code outside emphasis."
19
+
20
+
21
+ class CheckInlineMarkup(ContentCheck):
22
+ """Report inline literals inside reStructuredText emphasis."""
23
+
24
+ REPORTS = frozenset({_DIAGNOSTIC_CODE})
25
+
26
+ @override
27
+ def report_iter(
28
+ self,
29
+ parsed_file: ParsedFile,
30
+ ) -> Iterator[tuple[int, str, str]]:
31
+ if parsed_file.extension.lower() == ".rst":
32
+ for line in lint(
33
+ text=parsed_file.contents,
34
+ source=parsed_file.filename,
35
+ ):
36
+ yield line, _DIAGNOSTIC_CODE, _DIAGNOSTIC_MESSAGE
@@ -0,0 +1,99 @@
1
+ """Lint inline code nested inside reStructuredText emphasis."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING, override
6
+
7
+ from docutils import nodes
8
+ from docutils.frontend import get_default_settings
9
+ from docutils.parsers.rst import Parser
10
+ from docutils.parsers.rst.states import Inliner
11
+ from docutils.utils import escape2null, new_document
12
+
13
+ if TYPE_CHECKING:
14
+ from re import Match
15
+ from types import SimpleNamespace
16
+
17
+ type _InlineResult = tuple[
18
+ str, list[nodes.Node], str, list[nodes.system_message]
19
+ ]
20
+
21
+
22
+ class _LintInliner(Inliner):
23
+ """Look for inline literals left as text by the emphasis handlers."""
24
+
25
+ # Docutils interpolates these patterns from the concrete class namespace.
26
+ simplename = Inliner.simplename
27
+ emailc = Inliner.emailc
28
+ non_whitespace_after = Inliner.non_whitespace_after
29
+ non_whitespace_escape_before = Inliner.non_whitespace_escape_before
30
+ uric = Inliner.uric
31
+ uri_end = Inliner.uri_end
32
+ non_unescaped_whitespace_escape_before = (
33
+ Inliner.non_unescaped_whitespace_escape_before
34
+ )
35
+
36
+ def __init__(self) -> None:
37
+ super().__init__()
38
+ self.dispatch = {
39
+ **self.dispatch,
40
+ # Docutils dispatches to unbound methods with the inliner as
41
+ # the first argument. types-docutils models these as bound.
42
+ "*": _LintInliner._emphasis, # type: ignore[dict-item]
43
+ "**": _LintInliner._emphasis, # type: ignore[dict-item]
44
+ }
45
+ self.lines: list[int] = []
46
+ self._paragraph_lines = 0
47
+
48
+ @override
49
+ def parse(
50
+ self,
51
+ text: str,
52
+ lineno: int,
53
+ memo: SimpleNamespace,
54
+ parent: nodes.Element,
55
+ ) -> tuple[list[nodes.Node], list[nodes.system_message]]:
56
+ self._paragraph_lines = text.count("\n")
57
+ return super().parse(text, lineno, memo, parent)
58
+
59
+ def _emphasis(self, match: Match[str], lineno: int) -> _InlineResult:
60
+ delimiter = match["start"]
61
+ handler = Inliner.strong if delimiter == "**" else Inliner.emphasis
62
+ before, inlines, remaining, messages = handler(self, match, lineno)
63
+ if inlines and isinstance(inlines[0], (nodes.strong, nodes.emphasis)):
64
+ raw = inlines[0].rawsource
65
+ body = raw[len(delimiter) : -len(delimiter)]
66
+ offset = self._literal_offset(text=body)
67
+ if offset is not None:
68
+ # Docutils passes the unconsumed suffix of the paragraph to
69
+ # each inline handler and keeps its original line number.
70
+ span_offset = self._paragraph_lines - match.string.count("\n")
71
+ self.lines.append(
72
+ lineno + span_offset + before.count("\n") + offset
73
+ )
74
+ return before, list(inlines), remaining, messages
75
+
76
+ def _literal_offset(self, *, text: str) -> int | None:
77
+ escaped = escape2null(text)
78
+ for match in self.patterns.initial.finditer(escaped):
79
+ if match["start"] != "\x60\x60" or self.quoted_start(match):
80
+ continue
81
+ end = self.patterns.literal.search(escaped[match.end("start") :])
82
+ if end and end.start(1):
83
+ return escaped.count("\n", 0, match.start("start"))
84
+ return None
85
+
86
+
87
+ def lint(*, text: str, source: str) -> list[int]:
88
+ """Return the line of the first nested inline literal per emphasis span."""
89
+ inliner = _LintInliner()
90
+ parser = Parser(inliner=inliner)
91
+ settings = get_default_settings(Parser)
92
+ settings.file_insertion_enabled = False
93
+ settings.raw_enabled = False
94
+ settings.report_level = 5
95
+ settings.halt_level = 6
96
+ settings.syntax_highlight = "none"
97
+ document = new_document(source, settings=settings)
98
+ parser.parse(text, document)
99
+ return sorted(inliner.lines)
@@ -0,0 +1,59 @@
1
+ Metadata-Version: 2.4
2
+ Name: doc8-inline-markup
3
+ Version: 2026.11.18.3
4
+ Summary: A doc8 plugin for inline literals inside reStructuredText emphasis.
5
+ Author-email: Adam Dangoor <adamdangoor@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Source, https://github.com/adamtheturtle/doc8-inline-markup
8
+ Keywords: doc8,restructuredtext
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Environment :: Console
11
+ Classifier: Operating System :: Microsoft :: Windows
12
+ Classifier: Operating System :: POSIX
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Programming Language :: Python :: 3.12
15
+ Classifier: Programming Language :: Python :: 3.13
16
+ Classifier: Programming Language :: Python :: 3.14
17
+ Classifier: Programming Language :: Python :: 3.15
18
+ Classifier: Topic :: Software Development :: Quality Assurance
19
+ Requires-Python: >=3.12
20
+ Description-Content-Type: text/x-rst
21
+ License-File: LICENSE
22
+ Requires-Dist: doc8<3,>=2
23
+ Requires-Dist: docutils<0.24,>=0.21
24
+ Dynamic: license-file
25
+
26
+ doc8 Inline Markup
27
+ ==================
28
+
29
+ A doc8 plugin that detects inline literals inside bold or italic
30
+ reStructuredText. Docutils treats the inner backticks as text, which
31
+ makes the code render with visible backticks. The check reports RST001.
32
+
33
+ For example, change this note::
34
+
35
+ .. note:: **``event_id`` deduplication**
36
+
37
+ to::
38
+
39
+ .. note:: ``event_id`` deduplication
40
+
41
+ Installation
42
+ ------------
43
+
44
+ Install the plugin in the same environment as doc8. For a uv project,
45
+ add it as a development dependency::
46
+
47
+ uv add --dev doc8-inline-markup
48
+
49
+ Run doc8 as usual::
50
+
51
+ uv run doc8 docs/guide.rst
52
+
53
+ doc8 discovers the plugin automatically. It checks .rst files, skips code
54
+ blocks and comments, and supports doc8's standard ignore settings. Run doc8
55
+ on included files directly. Content in extension directives that Docutils
56
+ cannot parse is outside the check's scope.
57
+
58
+ If you used rst-inline-markup-lint, replace that dependency with
59
+ doc8-inline-markup and remove any standalone hook entry for the old package.
@@ -0,0 +1,27 @@
1
+ .gitattributes
2
+ .gitignore
3
+ LICENSE
4
+ MANIFEST.in
5
+ README.rst
6
+ prek.toml
7
+ pyproject.toml
8
+ .github/dependabot.yml
9
+ .github/workflows/ci.yml
10
+ .github/workflows/lint.yml
11
+ .github/workflows/release.yml
12
+ src/doc8_inline_markup/__init__.py
13
+ src/doc8_inline_markup/_doc8.py
14
+ src/doc8_inline_markup/_rst.py
15
+ src/doc8_inline_markup/py.typed
16
+ src/doc8_inline_markup.egg-info/PKG-INFO
17
+ src/doc8_inline_markup.egg-info/SOURCES.txt
18
+ src/doc8_inline_markup.egg-info/dependency_links.txt
19
+ src/doc8_inline_markup.egg-info/entry_points.txt
20
+ src/doc8_inline_markup.egg-info/not-zip-safe
21
+ src/doc8_inline_markup.egg-info/requires.txt
22
+ src/doc8_inline_markup.egg-info/scm_file_list.json
23
+ src/doc8_inline_markup.egg-info/scm_version.json
24
+ src/doc8_inline_markup.egg-info/top_level.txt
25
+ tests/__init__.py
26
+ tests/test_doc8.py
27
+ tests/test_lint.py
@@ -0,0 +1,2 @@
1
+ [doc8.extension.check]
2
+ doc8-inline-markup = doc8_inline_markup._doc8:CheckInlineMarkup
@@ -0,0 +1,2 @@
1
+ doc8<3,>=2
2
+ docutils<0.24,>=0.21
@@ -0,0 +1,22 @@
1
+ {
2
+ "files": [
3
+ ".gitattributes",
4
+ ".github/dependabot.yml",
5
+ ".github/workflows/ci.yml",
6
+ ".github/workflows/lint.yml",
7
+ ".github/workflows/release.yml",
8
+ ".gitignore",
9
+ "LICENSE",
10
+ "MANIFEST.in",
11
+ "README.rst",
12
+ "prek.toml",
13
+ "pyproject.toml",
14
+ "src/doc8_inline_markup/__init__.py",
15
+ "src/doc8_inline_markup/_doc8.py",
16
+ "src/doc8_inline_markup/_rst.py",
17
+ "src/doc8_inline_markup/py.typed",
18
+ "tests/__init__.py",
19
+ "tests/test_doc8.py",
20
+ "tests/test_lint.py"
21
+ ]
22
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "2026.11.18.3",
3
+ "distance": 0,
4
+ "node": "g05c4c0f423a9bdb78bb5377148e00a0482196747",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-11-18"
8
+ }
@@ -0,0 +1 @@
1
+ """Tests for doc8-inline-markup."""
@@ -0,0 +1,53 @@
1
+ """Check the packaged doc8 entry point with doc8's CLI."""
2
+
3
+ from __future__ import annotations
4
+
5
+ import shutil
6
+ import subprocess
7
+ from typing import TYPE_CHECKING
8
+
9
+ import pytest
10
+
11
+ if TYPE_CHECKING:
12
+ from pathlib import Path
13
+
14
+
15
+ @pytest.mark.parametrize(
16
+ ("filename", "content", "expected_status"),
17
+ [
18
+ ("bad.rst", "**``event_id`` deduplication**\n", 1),
19
+ ("good.rst", "``event_id`` deduplication\n", 0),
20
+ ("notes.txt", "**``event_id`` deduplication**\n", 0),
21
+ ],
22
+ )
23
+ def test_doc8(
24
+ *,
25
+ tmp_path: Path,
26
+ filename: str,
27
+ content: str,
28
+ expected_status: int,
29
+ ) -> None:
30
+ """Detect nested literals only in RST files processed by doc8."""
31
+ command = shutil.which("doc8")
32
+ assert command is not None
33
+ source = tmp_path / filename
34
+ _ = source.write_text(
35
+ f"Sample\n======\n\n{content}",
36
+ encoding="utf-8",
37
+ newline="\n",
38
+ )
39
+
40
+ result = subprocess.run(
41
+ [command, "--quiet", str(source)],
42
+ check=False,
43
+ capture_output=True,
44
+ text=True,
45
+ )
46
+
47
+ assert result.returncode == expected_status
48
+ assert result.stderr == ""
49
+ assert result.stdout.splitlines() == (
50
+ [f"{source}:4: RST001 Move inline code outside emphasis."]
51
+ if expected_status
52
+ else []
53
+ )
@@ -0,0 +1,46 @@
1
+ """Exercise the inline-markup check through Docutils."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import TYPE_CHECKING
6
+
7
+ import pytest
8
+
9
+ from doc8_inline_markup._rst import lint
10
+
11
+ if TYPE_CHECKING:
12
+ from pathlib import Path
13
+
14
+
15
+ @pytest.mark.parametrize(
16
+ ("text", "lines"),
17
+ [
18
+ (".. note:: **``event_id`` deduplication**\n", [1]),
19
+ ("*Use ``event_id`` for lookup.*\n", [1]),
20
+ ("First line.\n**Use\n``event_id`` here.**\n", [3]),
21
+ ("``ok``\n**``first``** and **``second``**\n", [2, 2]),
22
+ ("**``first`` and ``second``**\n", [1]),
23
+ ("**Use ``event\nid`` here.**\n", [1]),
24
+ ("**Documentation** and ``event_id``.\n", []),
25
+ ("**An unmatched ``marker**\n", []),
26
+ ("**A quoted pair '``' and ``.**\n", []),
27
+ ("**An escaped \\\x60\x60event_id``.**\n", []),
28
+ ("**``event_id`` with an unclosed span.\n", []),
29
+ (".. comment **``event_id``**\n", []),
30
+ (".. code-block:: rst\n\n **``event_id``**\n", []),
31
+ ("Example::\n\n **``event_id``**\n", []),
32
+ ("``**event_id**``\n", []),
33
+ (".. extension-directive::\n\n **``event_id``**\n", []),
34
+ ],
35
+ )
36
+ def test_inline_markup(*, text: str, lines: list[int]) -> None:
37
+ """Report emphasis spans that contain an inline literal."""
38
+ assert lint(text=text, source="test.rst") == lines
39
+
40
+
41
+ def test_include_is_not_read(*, tmp_path: Path) -> None:
42
+ """Leave included documents for independent lint runs."""
43
+ included = tmp_path / "included.rst"
44
+ _ = included.write_text("**``event_id``**\n", encoding="utf-8")
45
+ source = tmp_path / "guide.rst"
46
+ assert lint(text=".. include:: included.rst\n", source=str(source)) == []