Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit aa4e28f

Browse files
🔧 Add "store_labels" to OptionsType (#343)
Co-authored-by: hukkin <https://github.com/hukkin>
1 parent 876c366 commit aa4e28f

File tree

6 files changed

+19
-4
lines changed

6 files changed

+19
-4
lines changed

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,3 +141,5 @@ __pycache__/
141141
.DS_Store
142142

143143
docs/api/
144+
145+
uv.lock

‎.pre-commit-config.yaml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ repos:
3434
rev: v1.13.0
3535
hooks:
3636
- id: mypy
37-
additional_dependencies: [mdurl]
37+
additional_dependencies: [mdurl, typing-extensions]
3838
exclude: >
3939
(?x)^(
4040
benchmarking/.*\.py|

‎docs/conf.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
"EnvType",
5656
"Path",
5757
"Ellipsis",
58+
"NotRequired",
5859
)
5960
]
6061

‎docs/contributing.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ All functions and class methods should be annotated with types and include a doc
3232

3333
## Testing
3434

35-
For code tests, markdown-it-py uses [pytest](https://docs.pytest.org)):
35+
For code tests, markdown-it-py uses [pytest](https://docs.pytest.org):
3636

3737
```shell
3838
>> cd markdown-it-py

‎markdown_it/utils.py‎

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,11 @@
33
from collections.abc import Iterable, MutableMapping
44
from collections.abc import MutableMapping as MutableMappingABC
55
from pathlib import Path
6-
from typing import Any, Callable, TypedDict, cast
6+
from typing import TYPE_CHECKING, Any, Callable, TypedDict, cast
7+
8+
if TYPE_CHECKING:
9+
from typing_extensions import NotRequired
10+
711

812
EnvType = MutableMapping[str, Any] # note: could use TypeAlias in python 3.10
913
"""Type for the environment sandbox used in parsing and rendering,
@@ -32,6 +36,11 @@ class OptionsType(TypedDict):
3236
"""CSS language prefix for fenced blocks."""
3337
highlight: Callable[[str, str, str], str] | None
3438
"""Highlighter function: (content, lang, attrs) -> str."""
39+
store_labels: NotRequired[bool]
40+
"""Store link label in link/image token's metadata (under Token.meta['label']).
41+
42+
This is a Python only option, and is intended for the use of round-trip parsing.
43+
"""
3544

3645

3746
class PresetType(TypedDict):

‎pyproject.toml‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ benchmarking = [
7070
]
7171
profiling = ["gprof2dot"]
7272

73+
[dependency-groups]
74+
mypy = ["mypy", "mdurl", "typing-extensions"]
75+
7376
[project.scripts]
7477
markdown-it = "markdown_it.cli.parse:main"
7578

@@ -106,7 +109,7 @@ module = ["tests.test_plugins.*", "markdown.*"]
106109
ignore_errors = true
107110

108111
[[tool.mypy.overrides]]
109-
module = ["markdown.*"]
112+
module = ["markdown.*", "linkify_it.*"]
110113
ignore_missing_imports = true
111114

112115
[tool.pytest.ini_options]

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /