Skip to content

Commit c10312e

Browse files
[pre-commit.ci] pre-commit autoupdate (#323)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Chris Sewell <[email protected]>
1 parent 81a5e46 commit c10312e

38 files changed

+58
-41
lines changed

.pre-commit-config.yaml

+3-3
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,22 @@ exclude: >
1616
repos:
1717

1818
- repo: https://github.com/pre-commit/pre-commit-hooks
19-
rev: v4.5.0
19+
rev: v4.6.0
2020
hooks:
2121
- id: check-json
2222
- id: check-yaml
2323
- id: end-of-file-fixer
2424
- id: trailing-whitespace
2525

2626
- repo: https://github.com/astral-sh/ruff-pre-commit
27-
rev: v0.1.11
27+
rev: v0.4.3
2828
hooks:
2929
- id: ruff
3030
args: [--fix]
3131
- id: ruff-format
3232

3333
- repo: https://github.com/pre-commit/mirrors-mypy
34-
rev: v1.8.0
34+
rev: v1.10.0
3535
hooks:
3636
- id: mypy
3737
additional_dependencies: [mdurl]

markdown_it/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""A Python port of Markdown-It"""
2+
23
__all__ = ("MarkdownIt",)
34
__version__ = "3.0.0"
45

markdown_it/cli/parse.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
55
Parse one or more markdown files, convert each to HTML, and print to stdout.
66
"""
7+
78
from __future__ import annotations
89

910
import argparse

markdown_it/common/entities.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""HTML5 entities map: { name -> characters }."""
2+
23
import html.entities
34

45
entities = {name.rstrip(";"): chars for name, chars in html.entities.html5.items()}

markdown_it/common/html_re.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
"""Regexps to match html elements
2-
"""
1+
"""Regexps to match html elements"""
32

43
import re
54

markdown_it/common/utils.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Utilities for parsing source text
2-
"""
1+
"""Utilities for parsing source text"""
2+
33
from __future__ import annotations
44

55
import re

markdown_it/helpers/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Functions for parsing Links
2-
"""
1+
"""Functions for parsing Links"""
2+
33
__all__ = ("parseLinkLabel", "parseLinkDestination", "parseLinkTitle")
44
from .parse_link_destination import parseLinkDestination
55
from .parse_link_label import parseLinkLabel

markdown_it/helpers/parse_link_label.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
returns the end of the label
66
77
"""
8+
89
from markdown_it.rules_inline import StateInline
910

1011

markdown_it/helpers/parse_link_title.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Parse link title
2-
"""
1+
"""Parse link title"""
2+
33
from ..common.utils import charCodeAt, unescapeAll
44

55

markdown_it/main.py

+5-10
Original file line numberDiff line numberDiff line change
@@ -68,24 +68,19 @@ def __repr__(self) -> str:
6868
return f"{self.__class__.__module__}.{self.__class__.__name__}()"
6969

7070
@overload
71-
def __getitem__(self, name: Literal["inline"]) -> ParserInline:
72-
...
71+
def __getitem__(self, name: Literal["inline"]) -> ParserInline: ...
7372

7473
@overload
75-
def __getitem__(self, name: Literal["block"]) -> ParserBlock:
76-
...
74+
def __getitem__(self, name: Literal["block"]) -> ParserBlock: ...
7775

7876
@overload
79-
def __getitem__(self, name: Literal["core"]) -> ParserCore:
80-
...
77+
def __getitem__(self, name: Literal["core"]) -> ParserCore: ...
8178

8279
@overload
83-
def __getitem__(self, name: Literal["renderer"]) -> RendererProtocol:
84-
...
80+
def __getitem__(self, name: Literal["renderer"]) -> RendererProtocol: ...
8581

8682
@overload
87-
def __getitem__(self, name: str) -> Any:
88-
...
83+
def __getitem__(self, name: str) -> Any: ...
8984

9085
def __getitem__(self, name: str) -> Any:
9186
return {

markdown_it/parser_block.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Block-level tokenizer."""
2+
23
from __future__ import annotations
34

45
import logging

markdown_it/parser_core.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
"""
2-
* class Core
3-
*
4-
* Top-level rules executor. Glues block/inline parsers and does intermediate
5-
* transformations.
2+
* class Core
3+
*
4+
* Top-level rules executor. Glues block/inline parsers and does intermediate
5+
* transformations.
66
"""
7+
78
from __future__ import annotations
89

910
from typing import Callable

markdown_it/parser_inline.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Tokenizes paragraph content.
2-
"""
1+
"""Tokenizes paragraph content."""
2+
33
from __future__ import annotations
44

55
from typing import TYPE_CHECKING, Callable

markdown_it/presets/commonmark.py

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- block: table
77
- inline: strikethrough
88
"""
9+
910
from ..utils import PresetType
1011

1112

markdown_it/presets/default.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""markdown-it default options."""
2+
23
from ..utils import PresetType
34

45

markdown_it/presets/zero.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"Zero" preset, with nothing enabled. Useful for manual configuring of simple
33
modes. For example, to parse bold/italic only.
44
"""
5+
56
from ..utils import PresetType
67

78

markdown_it/renderer.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ class Renderer
55
copy of rules. Those can be rewritten with ease. Also, you can add new
66
rules if you create plugin and adds new token types.
77
"""
8+
89
from __future__ import annotations
910

1011
from collections.abc import Sequence
@@ -21,8 +22,7 @@ class RendererProtocol(Protocol):
2122

2223
def render(
2324
self, tokens: Sequence[Token], options: OptionsDict, env: EnvType
24-
) -> Any:
25-
...
25+
) -> Any: ...
2626

2727

2828
class RendererHTML(RendererProtocol):

markdown_it/ruler.py

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ class Ruler
1515
rules control use [[MarkdownIt.disable]], [[MarkdownIt.enable]] and
1616
[[MarkdownIt.use]].
1717
"""
18+
1819
from __future__ import annotations
1920

2021
from collections.abc import Iterable

markdown_it/rules_block/code.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Code block (4 spaces padded)."""
2+
23
import logging
34

45
from .state_block import StateBlock

markdown_it/rules_block/heading.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
""" Atex heading (#, ##, ...) """
1+
"""Atex heading (#, ##, ...)"""
2+
23
from __future__ import annotations
34

45
import logging

markdown_it/rules_block/hr.py

+1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
At least 3 of these characters on a line * - _
44
"""
5+
56
import logging
67

78
from ..common.utils import isStrSpace

markdown_it/rules_block/paragraph.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Paragraph."""
2+
23
import logging
34

45
from .state_block import StateBlock

markdown_it/rules_core/normalize.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Normalize input string."""
2+
23
import re
34

45
from .state_core import StateCore
@@ -13,6 +14,6 @@ def normalize(state: StateCore) -> None:
1314
string = NEWLINES_RE.sub("\n", state.src)
1415

1516
# Replace NULL characters
16-
string = NULL_RE.sub("\uFFFD", string)
17+
string = NULL_RE.sub("\ufffd", string)
1718

1819
state.src = string

markdown_it/rules_core/replacements.py

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* ``--`` → &ndash
1414
* ``---`` → &mdash
1515
"""
16+
1617
from __future__ import annotations
1718

1819
import logging

markdown_it/rules_core/smartquotes.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
"""Convert straight quotation marks to typographic ones
2-
"""
1+
"""Convert straight quotation marks to typographic ones"""
2+
33
from __future__ import annotations
44

55
import re

markdown_it/rules_core/text_join.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
66
For example, `\\:)` shouldn't be replaced with an emoji.
77
"""
8+
89
from __future__ import annotations
910

1011
from ..token import Token

markdown_it/rules_inline/balance_pairs.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Balance paired characters (*, _, etc) in inline tokens."""
2+
23
from __future__ import annotations
34

45
from .state_inline import Delimiter, StateInline

markdown_it/rules_inline/escape.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Process escaped chars and hardbreaks
33
"""
4+
45
from ..common.utils import isStrSpace
56
from .state_inline import StateInline
67

markdown_it/rules_inline/link.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ def link(state: StateInline, silent: bool) -> bool:
112112

113113
label = normalizeReference(label)
114114

115-
ref = (
116-
state.env["references"][label] if label in state.env["references"] else None
117-
)
115+
ref = state.env["references"].get(label, None)
118116
if not ref:
119117
state.pos = oldPos
120118
return False

markdown_it/rules_inline/linkify.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Process links like https://example.org/"""
2+
23
import re
34

45
from .state_inline import StateInline

markdown_it/rules_inline/newline.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Proceess '\n'."""
2+
23
from ..common.utils import charStrAt, isStrSpace
34
from .state_inline import StateInline
45

markdown_it/tree.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
33
This module is not part of upstream JavaScript markdown-it.
44
"""
5+
56
from __future__ import annotations
67

78
from collections.abc import Generator, Sequence
@@ -78,12 +79,10 @@ def __repr__(self) -> str:
7879
return f"{type(self).__name__}({self.type})"
7980

8081
@overload
81-
def __getitem__(self: _NodeType, item: int) -> _NodeType:
82-
...
82+
def __getitem__(self: _NodeType, item: int) -> _NodeType: ...
8383

8484
@overload
85-
def __getitem__(self: _NodeType, item: slice) -> list[_NodeType]:
86-
...
85+
def __getitem__(self: _NodeType, item: slice) -> list[_NodeType]: ...
8786

8887
def __getitem__(self: _NodeType, item: int | slice) -> _NodeType | list[_NodeType]:
8988
return self.children[item]

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ exclude = [
8383
"benchmarking/"
8484
]
8585

86-
[tool.ruff]
86+
[tool.ruff.lint]
8787
extend-select = ["B0", "C4", "I", "ICN", "ISC", "N", "RUF", "SIM", "UP"]
8888
extend-ignore = ["ISC001", "ISC003", "N802", "N803", "N806", "N816", "RUF003"]
8989

scripts/build_fuzzers.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Build fuzzers idempotently in a given folder."""
2+
23
import argparse
34
from pathlib import Path
45
import subprocess

scripts/profiler.py

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
- `tox -e profile`
55
- `firefox .tox/prof/output.svg`
66
"""
7+
78
from pathlib import Path
89

910
from markdown_it import MarkdownIt

tests/test_api/test_plugin_creation.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""Test basic plugin creation functionality:
22
that they can be added and are called correctly
33
"""
4+
45
from markdown_it import MarkdownIt
56

67

tests/test_cmark_spec/test_spec.py

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""In this module tests are run against the full test set,
22
provided by https://github.com/commonmark/CommonMark.git.
33
"""
4+
45
import json
56
from pathlib import Path
67

tests/test_fuzzer.py

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
In the future, perhaps atheris could be directly used here,
66
but it was not directly apparent how to integrate it into pytest.
77
"""
8+
89
import pytest
910

1011
from markdown_it import MarkdownIt

0 commit comments

Comments
 (0)