Skip to content

⬆️ UPGRADE: Allow markdown-it-py v3 #85

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 3, 2023
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
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ repos:
rev: v1.3.0
hooks:
- id: mypy
additional_dependencies: [markdown-it-py~=2.0]
additional_dependencies: [markdown-it-py~=3.0]
2 changes: 1 addition & 1 deletion mdit_py_plugins/attrs/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ def _span_rule(state: StateInline, silent: bool):
state.pos = labelStart
state.posMax = labelEnd
token = state.push("span_open", "span", 1)
token.attrs = attrs
token.attrs = attrs # type: ignore
state.md.inline.tokenize(state)
token = state.push("span_close", "span", -1)

Expand Down
3 changes: 2 additions & 1 deletion mdit_py_plugins/footnote/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from markdown_it import MarkdownIt
from markdown_it.helpers import parseLinkLabel
from markdown_it.rules_block import StateBlock
from markdown_it.rules_core import StateCore
from markdown_it.rules_inline import StateInline
from markdown_it.token import Token

Expand Down Expand Up @@ -253,7 +254,7 @@ def footnote_ref(state: StateInline, silent: bool):
return True


def footnote_tail(state: StateBlock, *args, **kwargs):
def footnote_tail(state: StateCore) -> None:
"""Post-processing step, to move footnote tokens to end of the token stream.

Also removes un-referenced tokens.
Expand Down
2 changes: 1 addition & 1 deletion mdit_py_plugins/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ def is_code_block(state: StateBlock, line: int) -> bool:
"""Check if the line is part of a code block, compat for markdown-it-py v2."""
try:
# markdown-it-py v3+
return state.is_code_block(line) # type: ignore[attr-defined]
return state.is_code_block(line)
except AttributeError:
pass

Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ classifiers = [
]
keywords = ["markdown", "markdown-it", "lexer", "parser", "development"]
requires-python = ">=3.8"
dependencies = ["markdown-it-py>=1.0.0,<3.0.0"]
dependencies = ["markdown-it-py>=1.0.0,<4.0.0"]

[project.urls]
Homepage = "https://github.com/executablebooks/mdit-py-plugins"
Expand Down