diff -Nru mdit-py-plugins-0.3.0/CHANGELOG.md mdit-py-plugins-0.3.1/CHANGELOG.md --- mdit-py-plugins-0.3.0/CHANGELOG.md 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/CHANGELOG.md 2022-09-27 07:27:03.000000000 +0000 @@ -1,5 +1,13 @@ # Change Log +## 0.3.1 - 2022-09-27 + +- ⬆️ UPGRADE: Drop Python 3.6, support Python 3.10 +- 🐛 FIX: Parsing when newline is between footnote ID and first paragraph +- 🐛 FIX: Anchor ids in separate renders no longer affect each other. +- ✨ NEW: Add `attrs_plugin` +- 🔧 MAINTAIN: Use flit PEP 621 package build + ## 0.3.0 - 2021-12-03 - ⬆️ UPGRADE: Compatible with markdown-it-py `v2`. diff -Nru mdit-py-plugins-0.3.0/debian/changelog mdit-py-plugins-0.3.1/debian/changelog --- mdit-py-plugins-0.3.0/debian/changelog 2022-01-11 03:16:03.000000000 +0000 +++ mdit-py-plugins-0.3.1/debian/changelog 2022-10-19 18:53:07.000000000 +0000 @@ -1,3 +1,22 @@ +mdit-py-plugins (0.3.1-2) unstable; urgency=medium + + * source-only upload. + + -- Emmanuel Arias Wed, 19 Oct 2022 15:53:07 -0300 + +mdit-py-plugins (0.3.1-1) unstable; urgency=medium + + * New upstream version. + * d/control: Add flit as Build Depends. Remove python3-setuptools from + B-Depends, it's not longer needed. + * d/control: Bump Standards-Version to 4.6.1.1 (from 4.6.0.1; no further + changes needed). + * d/tests/control: Stop using @builddeps@ in Depends. Add python3-all, + python3-markdown-it, python3-pytest, python3-pytest-regressions as + Dependencies for autopkgtests. + + -- Emmanuel Arias Mon, 03 Oct 2022 18:46:20 -0300 + mdit-py-plugins (0.3.0-1) unstable; urgency=medium * New upstream release. diff -Nru mdit-py-plugins-0.3.0/debian/control mdit-py-plugins-0.3.1/debian/control --- mdit-py-plugins-0.3.0/debian/control 2022-01-11 03:16:03.000000000 +0000 +++ mdit-py-plugins-0.3.1/debian/control 2022-10-10 15:47:56.000000000 +0000 @@ -4,13 +4,13 @@ Maintainer: Debian Python Team Uploaders: Emmanuel Arias , Build-Depends: debhelper-compat (= 13), + flit, pybuild-plugin-pyproject, python3-all, python3-markdown-it , python3-pytest , python3-pytest-regressions , - python3-setuptools, -Standards-Version: 4.6.0.1 +Standards-Version: 4.6.1.1 Homepage: https://github.com/executablebooks/mdit-py-plugins Vcs-Git: https://salsa.debian.org/python-team/packages/mdit-py-plugins.git Vcs-Browser: https://salsa.debian.org/python-team/packages/mdit-py-plugins diff -Nru mdit-py-plugins-0.3.0/debian/tests/control mdit-py-plugins-0.3.1/debian/tests/control --- mdit-py-plugins-0.3.0/debian/tests/control 2022-01-11 03:16:03.000000000 +0000 +++ mdit-py-plugins-0.3.1/debian/tests/control 2022-10-10 15:47:56.000000000 +0000 @@ -1,3 +1,6 @@ Tests: unittests -Depends: @, - @builddeps@, +Depends: python3-all, + python3-markdown-it, + python3-pytest, + python3-pytest-regressions, + @, diff -Nru mdit-py-plugins-0.3.0/docs/index.md mdit-py-plugins-0.3.1/docs/index.md --- mdit-py-plugins-0.3.0/docs/index.md 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/docs/index.md 2022-09-27 07:27:03.000000000 +0000 @@ -85,6 +85,12 @@ .. autofunction:: mdit_py_plugins.container.container_plugin ``` +## Inline Attributes + +```{eval-rst} +.. autofunction:: mdit_py_plugins.attrs.attrs_plugin +``` + ## Math ```{eval-rst} diff -Nru mdit-py-plugins-0.3.0/.github/workflows/tests.yml mdit-py-plugins-0.3.1/.github/workflows/tests.yml --- mdit-py-plugins-0.3.0/.github/workflows/tests.yml 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/.github/workflows/tests.yml 2022-09-27 07:27:03.000000000 +0000 @@ -28,8 +28,9 @@ runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: [pypy3, 3.6, 3.7, 3.8, 3.9] + python-version: ['pypy-3.7', '3.7', '3.8', '3.9', '3.10'] steps: - uses: actions/checkout@v2 @@ -64,13 +65,13 @@ - name: Set up Python uses: actions/setup-python@v2 with: - python-version: 3.8 - - name: Build package + python-version: "3.8" + - name: install flit run: | - pip install build - python -m build - - name: Publish - uses: pypa/gh-action-pypi-publish@v1.1.0 - with: - user: __token__ - password: ${{ secrets.PYPI_KEY }} + pip install flit~=3.4 + - name: Build and publish + run: | + flit publish + env: + FLIT_USERNAME: __token__ + FLIT_PASSWORD: ${{ secrets.PYPI_KEY }} diff -Nru mdit-py-plugins-0.3.0/MANIFEST.in mdit-py-plugins-0.3.1/MANIFEST.in --- mdit-py-plugins-0.3.0/MANIFEST.in 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/MANIFEST.in 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ -exclude docs -recursive-exclude docs * -exclude tests -recursive-exclude tests * - -exclude .pre-commit-config.yaml -exclude .readthedocs.yml -exclude tox.ini -exclude .flake8 -exclude codecov.yml -exclude .mypy.ini - -include LICENSE -include CHANGELOG.md -include mdit_py_plugins/py.typed - -recursive-include mdit_py_plugins port.yaml LICENSE README.md diff -Nru mdit-py-plugins-0.3.0/mdit_py_plugins/anchors/index.py mdit-py-plugins-0.3.1/mdit_py_plugins/anchors/index.py --- mdit-py-plugins-0.3.0/mdit_py_plugins/anchors/index.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/mdit_py_plugins/anchors/index.py 2022-09-27 07:27:03.000000000 +0000 @@ -65,9 +65,8 @@ permalinkBefore: bool, permalinkSpace: bool, ): - slugs: Set[str] = set() - def _anchor_func(state: StateCore): + slugs: Set[str] = set() for (idx, token) in enumerate(state.tokens): if token.type != "heading_open": continue diff -Nru mdit-py-plugins-0.3.0/mdit_py_plugins/attrs/index.py mdit-py-plugins-0.3.1/mdit_py_plugins/attrs/index.py --- mdit-py-plugins-0.3.0/mdit_py_plugins/attrs/index.py 1970-01-01 00:00:00.000000000 +0000 +++ mdit-py-plugins-0.3.1/mdit_py_plugins/attrs/index.py 2022-09-27 07:27:03.000000000 +0000 @@ -0,0 +1,50 @@ +from markdown_it import MarkdownIt +from markdown_it.rules_inline import StateInline + +from .parse import ParseError, parse + + +def attrs_plugin(md: MarkdownIt, *, after=("image", "code_inline")): + """Parse inline attributes that immediately follow certain inline elements:: + + ![alt](https://image.com){#id .a b=c} + + Inside the curly braces, the following syntax is possible: + + - `.foo` specifies foo as a class. + Multiple classes may be given in this way; they will be combined. + - `#foo` specifies foo as an identifier. + An element may have only one identifier; + if multiple identifiers are given, the last one is used. + - `key="value"` or `key=value` specifies a key-value attribute. + Quotes are not needed when the value consists entirely of + ASCII alphanumeric characters or `_` or `:` or `-`. + Backslash escapes may be used inside quoted values. + - `%` begins a comment, which ends with the next `%` or the end of the attribute (`}`). + + **Note:** This plugin is currently limited to "self-closing" elements, + such as images and code spans. It does not work with links or emphasis. + + :param md: The MarkdownIt instance to modify. + :param after: The names of inline elements after which attributes may be specified. + """ + + def attr_rule(state: StateInline, silent: bool): + if state.pending or not state.tokens: + return False + token = state.tokens[-1] + if token.type not in after: + return False + try: + new_pos, attrs = parse(state.src[state.pos :]) + except ParseError: + return False + state.pos += new_pos + 1 + if not silent: + if "class" in attrs and "class" in token.attrs: + attrs["class"] = f"{token.attrs['class']} {attrs['class']}" + token.attrs.update(attrs) + + return True + + md.inline.ruler.push("attr", attr_rule) diff -Nru mdit-py-plugins-0.3.0/mdit_py_plugins/attrs/__init__.py mdit-py-plugins-0.3.1/mdit_py_plugins/attrs/__init__.py --- mdit-py-plugins-0.3.0/mdit_py_plugins/attrs/__init__.py 1970-01-01 00:00:00.000000000 +0000 +++ mdit-py-plugins-0.3.1/mdit_py_plugins/attrs/__init__.py 2022-09-27 07:27:03.000000000 +0000 @@ -0,0 +1 @@ +from .index import attrs_plugin # noqa: F401 diff -Nru mdit-py-plugins-0.3.0/mdit_py_plugins/attrs/parse.py mdit-py-plugins-0.3.1/mdit_py_plugins/attrs/parse.py --- mdit-py-plugins-0.3.0/mdit_py_plugins/attrs/parse.py 1970-01-01 00:00:00.000000000 +0000 +++ mdit-py-plugins-0.3.1/mdit_py_plugins/attrs/parse.py 2022-09-27 07:27:03.000000000 +0000 @@ -0,0 +1,265 @@ +"""Parser for attributes:: + + attributes { id = "foo", class = "bar baz", + key1 = "val1", key2 = "val2" } + +Adapted from: +https://github.com/jgm/djot/blob/fae7364b86bfce69bc6d5b5eede1f5196d845fd6/djot/attributes.lua#L1 + +syntax: + +attributes <- '{' whitespace* attribute (whitespace attribute)* whitespace* '}' +attribute <- identifier | class | keyval +identifier <- '#' name +class <- '.' name +name <- (nonspace, nonpunctuation other than ':', '_', '-')+ +keyval <- key '=' val +key <- (ASCII_ALPHANUM | ':' | '_' | '-')+ +val <- bareval | quotedval +bareval <- (ASCII_ALPHANUM | ':' | '_' | '-')+ +quotedval <- '"' ([^"] | '\"') '"' +""" +from __future__ import annotations + +from enum import Enum +import re +from typing import Callable + + +class State(Enum): + START = 0 + SCANNING = 1 + SCANNING_ID = 2 + SCANNING_CLASS = 3 + SCANNING_KEY = 4 + SCANNING_VALUE = 5 + SCANNING_BARE_VALUE = 6 + SCANNING_QUOTED_VALUE = 7 + SCANNING_COMMENT = 8 + SCANNING_ESCAPED = 9 + DONE = 10 + + +REGEX_SPACE = re.compile(r"\s") +REGEX_SPACE_PUNCTUATION = re.compile(r"[\s!\"#$%&'()*+,./;<=>?@[\]^`{|}~]") +REGEX_KEY_CHARACTERS = re.compile(r"[a-zA-Z\d_:-]") + + +class TokenState: + def __init__(self): + self._tokens = [] + self.start: int = 0 + + def set_start(self, start: int) -> None: + self.start = start + + def append(self, start: int, end: int, ttype: str): + self._tokens.append((start, end, ttype)) + + def compile(self, string: str) -> dict[str, str]: + """compile the tokens into a dictionary""" + attributes = {} + classes = [] + idx = 0 + while idx < len(self._tokens): + start, end, ttype = self._tokens[idx] + if ttype == "id": + attributes["id"] = string[start:end] + elif ttype == "class": + classes.append(string[start:end]) + elif ttype == "key": + key = string[start:end] + if idx + 1 < len(self._tokens): + start, end, ttype = self._tokens[idx + 1] + if ttype == "value": + if key == "class": + classes.append(string[start:end]) + else: + attributes[key] = string[start:end] + idx += 1 + idx += 1 + if classes: + attributes["class"] = " ".join(classes) + return attributes + + def __str__(self) -> str: + return str(self._tokens) + + def __repr__(self) -> str: + return repr(self._tokens) + + +class ParseError(Exception): + def __init__(self, msg: str, pos: int) -> None: + self.pos = pos + super().__init__(msg + f" at position {pos}") + + +def parse(string: str) -> tuple[int, dict[str, str]]: + """Parse attributes from start of string. + + :returns: (length of parsed string, dict of attributes) + """ + pos = 0 + state: State = State.START + tokens = TokenState() + while pos < len(string): + state = HANDLERS[state](string[pos], pos, tokens) + if state == State.DONE: + return pos, tokens.compile(string) + pos = pos + 1 + + return pos, tokens.compile(string) + + +def handle_start(char: str, pos: int, tokens: TokenState) -> State: + + if char == "{": + return State.SCANNING + raise ParseError("Attributes must start with '{'", pos) + + +def handle_scanning(char: str, pos: int, tokens: TokenState) -> State: + + if char == " " or char == "\t" or char == "\n" or char == "\r": + return State.SCANNING + if char == "}": + return State.DONE + if char == "#": + tokens.set_start(pos) + return State.SCANNING_ID + if char == "%": + tokens.set_start(pos) + return State.SCANNING_COMMENT + if char == ".": + tokens.set_start(pos) + return State.SCANNING_CLASS + if REGEX_KEY_CHARACTERS.fullmatch(char): + tokens.set_start(pos) + return State.SCANNING_KEY + + raise ParseError(f"Unexpected character whilst scanning: {char}", pos) + + +def handle_scanning_comment(char: str, pos: int, tokens: TokenState) -> State: + + if char == "%": + return State.SCANNING + + return State.SCANNING_COMMENT + + +def handle_scanning_id(char: str, pos: int, tokens: TokenState) -> State: + + if not REGEX_SPACE_PUNCTUATION.fullmatch(char): + return State.SCANNING_ID + + if char == "}": + if (pos - 1) > tokens.start: + tokens.append(tokens.start + 1, pos, "id") + return State.DONE + + if REGEX_SPACE.fullmatch(char): + if (pos - 1) > tokens.start: + tokens.append(tokens.start + 1, pos, "id") + return State.SCANNING + + raise ParseError(f"Unexpected character whilst scanning id: {char}", pos) + + +def handle_scanning_class(char: str, pos: int, tokens: TokenState) -> State: + + if not REGEX_SPACE_PUNCTUATION.fullmatch(char): + return State.SCANNING_CLASS + + if char == "}": + if (pos - 1) > tokens.start: + tokens.append(tokens.start + 1, pos, "class") + return State.DONE + + if REGEX_SPACE.fullmatch(char): + if (pos - 1) > tokens.start: + tokens.append(tokens.start + 1, pos, "class") + return State.SCANNING + + raise ParseError(f"Unexpected character whilst scanning class: {char}", pos) + + +def handle_scanning_key(char: str, pos: int, tokens: TokenState) -> State: + + if char == "=": + tokens.append(tokens.start, pos, "key") + return State.SCANNING_VALUE + + if REGEX_KEY_CHARACTERS.fullmatch(char): + return State.SCANNING_KEY + + raise ParseError(f"Unexpected character whilst scanning key: {char}", pos) + + +def handle_scanning_value(char: str, pos: int, tokens: TokenState) -> State: + + if char == '"': + tokens.set_start(pos) + return State.SCANNING_QUOTED_VALUE + + if REGEX_KEY_CHARACTERS.fullmatch(char): + tokens.set_start(pos) + return State.SCANNING_BARE_VALUE + + raise ParseError(f"Unexpected character whilst scanning value: {char}", pos) + + +def handle_scanning_bare_value(char: str, pos: int, tokens: TokenState) -> State: + + if REGEX_KEY_CHARACTERS.fullmatch(char): + return State.SCANNING_BARE_VALUE + + if char == "}": + tokens.append(tokens.start, pos, "value") + return State.DONE + + if REGEX_SPACE.fullmatch(char): + tokens.append(tokens.start, pos, "value") + return State.SCANNING + + raise ParseError(f"Unexpected character whilst scanning bare value: {char}", pos) + + +def handle_scanning_escaped(char: str, pos: int, tokens: TokenState) -> State: + return State.SCANNING_QUOTED_VALUE + + +def handle_scanning_quoted_value(char: str, pos: int, tokens: TokenState) -> State: + + if char == '"': + tokens.append(tokens.start + 1, pos, "value") + return State.SCANNING + + if char == "\\": + return State.SCANNING_ESCAPED + + if char == "{" or char == "}": + raise ParseError( + f"Unexpected character whilst scanning quoted value: {char}", pos + ) + + if char == "\n": + tokens.append(tokens.start + 1, pos, "value") + return State.SCANNING_QUOTED_VALUE + + return State.SCANNING_QUOTED_VALUE + + +HANDLERS: dict[State, Callable[[str, int, TokenState], State]] = { + State.START: handle_start, + State.SCANNING: handle_scanning, + State.SCANNING_COMMENT: handle_scanning_comment, + State.SCANNING_ID: handle_scanning_id, + State.SCANNING_CLASS: handle_scanning_class, + State.SCANNING_KEY: handle_scanning_key, + State.SCANNING_VALUE: handle_scanning_value, + State.SCANNING_BARE_VALUE: handle_scanning_bare_value, + State.SCANNING_QUOTED_VALUE: handle_scanning_quoted_value, + State.SCANNING_ESCAPED: handle_scanning_escaped, +} diff -Nru mdit-py-plugins-0.3.0/mdit_py_plugins/footnote/index.py mdit-py-plugins-0.3.1/mdit_py_plugins/footnote/index.py --- mdit-py-plugins-0.3.0/mdit_py_plugins/footnote/index.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/mdit_py_plugins/footnote/index.py 2022-09-27 07:27:03.000000000 +0000 @@ -80,7 +80,7 @@ if pos == start + 2: # no empty footnote labels return False pos += 1 - if pos + 1 >= maximum or state.srcCharCode[pos] != 0x3A: # /* : */ + if pos >= maximum or state.srcCharCode[pos] != 0x3A: # /* : */ return False if silent: return True diff -Nru mdit-py-plugins-0.3.0/mdit_py_plugins/__init__.py mdit-py-plugins-0.3.1/mdit_py_plugins/__init__.py --- mdit-py-plugins-0.3.0/mdit_py_plugins/__init__.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/mdit_py_plugins/__init__.py 2022-09-27 07:27:03.000000000 +0000 @@ -1 +1 @@ -__version__ = "0.3.0" +__version__ = "0.3.1" diff -Nru mdit-py-plugins-0.3.0/.pre-commit-config.yaml mdit-py-plugins-0.3.1/.pre-commit-config.yaml --- mdit-py-plugins-0.3.0/.pre-commit-config.yaml 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/.pre-commit-config.yaml 2022-09-27 07:27:03.000000000 +0000 @@ -12,45 +12,31 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v3.3.0 + rev: v4.3.0 hooks: - id: check-json - id: check-yaml - id: end-of-file-fixer - id: trailing-whitespace - - repo: https://github.com/mgedmin/check-manifest - rev: "0.46" - hooks: - - id: check-manifest - args: [--no-build-isolation] - additional_dependencies: [setuptools>=46.4.0] - - # this is not used for now, - # since it converts mdit-py-plugins to mdit_py_plugins and removes comments - # - repo: https://github.com/asottile/setup-cfg-fmt - # rev: v1.17.0 - # hooks: - # - id: setup-cfg-fmt - - repo: https://github.com/timothycrosley/isort - rev: 5.8.0 + rev: 5.10.1 hooks: - id: isort - repo: https://github.com/psf/black - rev: 20.8b1 + rev: 22.8.0 hooks: - id: black - repo: https://gitlab.com/pycqa/flake8 - rev: 3.9.1 + rev: 3.9.2 hooks: - id: flake8 additional_dependencies: [flake8-bugbear==21.3.1] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.812 + rev: v0.971 hooks: - id: mypy - additional_dependencies: [markdown-it-py~=1.0] + additional_dependencies: [markdown-it-py~=2.0] diff -Nru mdit-py-plugins-0.3.0/pyproject.toml mdit-py-plugins-0.3.1/pyproject.toml --- mdit-py-plugins-0.3.0/pyproject.toml 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/pyproject.toml 2022-09-27 07:27:03.000000000 +0000 @@ -1,7 +1,67 @@ [build-system] -requires = ["setuptools>=46.4.0", "wheel"] -build-backend = "setuptools.build_meta" +requires = ["flit_core >=3.4,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "mdit-py-plugins" +dynamic = ["version"] +description = "Collection of plugins for markdown-it-py" +readme = "README.md" +authors = [{name = "Chris Sewell", email = "chrisj_sewell@hotmail.com"}] +license = {file = "LICENSE"} +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.7", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Topic :: Software Development :: Libraries :: Python Modules", + "Topic :: Text Processing :: Markup", +] +keywords = ["markdown", "markdown-it", "lexer", "parser", "development"] +requires-python = ">=3.7" +dependencies = ["markdown-it-py>=1.0.0,<3.0.0"] + +[project.urls] +Homepage = "https://github.com/executablebooks/mdit-py-plugins" +Documentation = "https://markdown-it-py.readthedocs.io" + +[project.optional-dependencies] +code_style = ["pre-commit"] +testing = [ + "coverage", + "pytest", + "pytest-cov", + "pytest-regressions", +] +rtd = [ + "attrs", + "myst-parser~=0.16.1", + "sphinx-book-theme~=0.1.0", +] + +[tool.flit.module] +name = "mdit_py_plugins" + +[tool.flit.sdist] +exclude = [ + "docs/", + "tests/", +] [tool.isort] profile = "black" +force_sort_within_sections = true known_first_party = ["mdit_py_plugins", "tests"] + +[tool.mypy] +show_error_codes = true +warn_unused_ignores = true +warn_redundant_casts = true +no_implicit_optional = true +strict_equality = true diff -Nru mdit-py-plugins-0.3.0/setup.cfg mdit-py-plugins-0.3.1/setup.cfg --- mdit-py-plugins-0.3.0/setup.cfg 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/setup.cfg 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -[metadata] -name = mdit-py-plugins -version = attr: mdit_py_plugins.__version__ -description = Collection of plugins for markdown-it-py -long_description = file: README.md -long_description_content_type = text/markdown -url = https://github.com/executablebooks/mdit-py-plugins -author = Chris Sewell -author_email = chrisj_sewell@hotmail.com -license = MIT -license_file = LICENSE -classifiers = - Development Status :: 4 - Beta - Intended Audience :: Developers - License :: OSI Approved :: MIT License - Programming Language :: Python :: 3 - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: Implementation :: CPython - Programming Language :: Python :: Implementation :: PyPy - Topic :: Software Development :: Libraries :: Python Modules - Topic :: Text Processing :: Markup -keywords = markdown, lexer, parser, development -project_urls = - Documentation=https://markdown-it-py.readthedocs.io - -[options] -packages = find: -install_requires = - markdown-it-py>=1.0.0,<3.0.0 -python_requires = ~=3.6 -include_package_data = True -zip_safe = True - -[options.packages.find] -exclude = - test* - benchmarking - -[options.extras_require] -code_style = - pre-commit==2.6 -testing = - coverage - pytest>=3.6,<4 - pytest-cov - pytest-regressions -rtd = - myst-parser~=0.14.0 - sphinx-book-theme~=0.1.0 - -[mypy] -show_error_codes = True -warn_unused_ignores = True -warn_redundant_casts = True -no_implicit_optional = True -strict_equality = True - -[flake8] -max-line-length = 100 -extend-ignore = E203,E731 diff -Nru mdit-py-plugins-0.3.0/setup.py mdit-py-plugins-0.3.1/setup.py --- mdit-py-plugins-0.3.0/setup.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/setup.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -# This file is needed for editable installs (`pip install -e .`). -# Can be removed once the following is resolved -# https://github.com/pypa/packaging-problems/issues/256 -from setuptools import setup - -setup() diff -Nru mdit-py-plugins-0.3.0/tests/fixtures/attrs.md mdit-py-plugins-0.3.1/tests/fixtures/attrs.md --- mdit-py-plugins-0.3.0/tests/fixtures/attrs.md 1970-01-01 00:00:00.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/fixtures/attrs.md 2022-09-27 07:27:03.000000000 +0000 @@ -0,0 +1,46 @@ +simple image +. +![a](b){#id .a b=c} +. +

a

+. + +simple inline code +. +`a`{#id .a b=c} +. +

a

+. + +ignore if space +. +![a](b) {#id key="*"} +. +

a {#id key="*"}

+. + +ignore if text +. +![a](b)b{#id key="*"} +. +

ab{#id key="*"}

+. + +multi-line +. +![a](b){ + #id .a + b=c + } +more +. +

a +more

+. + +combined +. +![a](b){#a .a}{.b class=x other=h}{#x class="x g" other=a} +. +

a

+. diff -Nru mdit-py-plugins-0.3.0/tests/fixtures/footnote.md mdit-py-plugins-0.3.1/tests/fixtures/footnote.md --- mdit-py-plugins-0.3.0/tests/fixtures/footnote.md 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/fixtures/footnote.md 2022-09-27 07:27:03.000000000 +0000 @@ -326,3 +326,21 @@ . + + +Newline after footnote identifier +. +[^a] + +[^a]: +b +. +

[1]

+

b

+
+
+
    +
  1. <-
  2. +
+
+. diff -Nru mdit-py-plugins-0.3.0/tests/test_amsmath.py mdit-py-plugins-0.3.1/tests/test_amsmath.py --- mdit-py-plugins-0.3.0/tests/test_amsmath.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_amsmath.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.amsmath import amsmath_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_anchors.py mdit-py-plugins-0.3.1/tests/test_anchors.py --- mdit-py-plugins-0.3.0/tests/test_anchors.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_anchors.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,8 +1,8 @@ from pathlib import Path -import pytest from markdown_it import MarkdownIt from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.anchors import anchors_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_attrs.py mdit-py-plugins-0.3.1/tests/test_attrs.py --- mdit-py-plugins-0.3.0/tests/test_attrs.py 1970-01-01 00:00:00.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_attrs.py 2022-09-27 07:27:03.000000000 +0000 @@ -0,0 +1,18 @@ +from pathlib import Path + +from markdown_it import MarkdownIt +from markdown_it.utils import read_fixture_file +import pytest + +from mdit_py_plugins.attrs import attrs_plugin + +FIXTURE_PATH = Path(__file__).parent.joinpath("fixtures", "attrs.md") + + +@pytest.mark.parametrize("line,title,input,expected", read_fixture_file(FIXTURE_PATH)) +def test_fixture(line, title, input, expected): + md = MarkdownIt("commonmark").use(attrs_plugin) + md.options["xhtmlOut"] = False + text = md.render(input) + print(text) + assert text.rstrip() == expected.rstrip() diff -Nru mdit-py-plugins-0.3.0/tests/test_colon_fence.py mdit-py-plugins-0.3.1/tests/test_colon_fence.py --- mdit-py-plugins-0.3.0/tests/test_colon_fence.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_colon_fence.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.colon_fence import colon_fence_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_container.py mdit-py-plugins-0.3.1/tests/test_container.py --- mdit-py-plugins-0.3.0/tests/test_container.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_container.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.container import container_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_deflist.py mdit-py-plugins-0.3.1/tests/test_deflist.py --- mdit-py-plugins-0.3.0/tests/test_deflist.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_deflist.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.deflist import deflist_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_dollarmath.py mdit-py-plugins-0.3.1/tests/test_dollarmath.py --- mdit-py-plugins-0.3.0/tests/test_dollarmath.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_dollarmath.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,11 +1,11 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.rules_block import StateBlock from markdown_it.rules_inline import StateInline from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.dollarmath import dollarmath_plugin from mdit_py_plugins.dollarmath import index as main diff -Nru mdit-py-plugins-0.3.0/tests/test_field_list.py mdit-py-plugins-0.3.1/tests/test_field_list.py --- mdit-py-plugins-0.3.0/tests/test_field_list.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_field_list.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.field_list import fieldlist_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_footnote.py mdit-py-plugins-0.3.1/tests/test_footnote.py --- mdit-py-plugins-0.3.0/tests/test_footnote.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_footnote.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,12 +1,12 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.rules_block import StateBlock from markdown_it.rules_inline import StateInline from markdown_it.token import Token from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.footnote import footnote_plugin, index diff -Nru mdit-py-plugins-0.3.0/tests/test_front_matter.py mdit-py-plugins-0.3.1/tests/test_front_matter.py --- mdit-py-plugins-0.3.0/tests/test_front_matter.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_front_matter.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path -import pytest from markdown_it import MarkdownIt from markdown_it.token import Token from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.front_matter import front_matter_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_myst_block.py mdit-py-plugins-0.3.1/tests/test_myst_block.py --- mdit-py-plugins-0.3.0/tests/test_myst_block.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_myst_block.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path -import pytest from markdown_it import MarkdownIt from markdown_it.token import Token from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.myst_blocks import myst_block_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_myst_role.py mdit-py-plugins-0.3.1/tests/test_myst_role.py --- mdit-py-plugins-0.3.0/tests/test_myst_role.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_myst_role.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path -import pytest from markdown_it import MarkdownIt from markdown_it.token import Token from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.myst_role import myst_role_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_substitution.py mdit-py-plugins-0.3.1/tests/test_substitution.py --- mdit-py-plugins-0.3.0/tests/test_substitution.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_substitution.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.utils import read_fixture_file +import pytest # from markdown_it.token import Token from mdit_py_plugins.substitution import substitution_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_tasklists.py mdit-py-plugins-0.3.1/tests/test_tasklists.py --- mdit-py-plugins-0.3.0/tests/test_tasklists.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_tasklists.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.tasklists import tasklists_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_texmath.py mdit-py-plugins-0.3.1/tests/test_texmath.py --- mdit-py-plugins-0.3.0/tests/test_texmath.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_texmath.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,11 +1,11 @@ from pathlib import Path from textwrap import dedent -import pytest from markdown_it import MarkdownIt from markdown_it.rules_block import StateBlock from markdown_it.rules_inline import StateInline from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.texmath import index as main from mdit_py_plugins.texmath import texmath_plugin diff -Nru mdit-py-plugins-0.3.0/tests/test_wordcount.py mdit-py-plugins-0.3.1/tests/test_wordcount.py --- mdit-py-plugins-0.3.0/tests/test_wordcount.py 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tests/test_wordcount.py 2022-09-27 07:27:03.000000000 +0000 @@ -1,9 +1,9 @@ import json from pathlib import Path -import pytest from markdown_it import MarkdownIt from markdown_it.utils import read_fixture_file +import pytest from mdit_py_plugins.wordcount import wordcount_plugin diff -Nru mdit-py-plugins-0.3.0/tox.ini mdit-py-plugins-0.3.1/tox.ini --- mdit-py-plugins-0.3.0/tox.ini 2021-12-03 08:05:57.000000000 +0000 +++ mdit-py-plugins-0.3.1/tox.ini 2022-09-27 07:27:03.000000000 +0000 @@ -9,7 +9,7 @@ [testenv] usedevelop = true -[testenv:py{36,37,38,39}] +[testenv:py{37,38,39,310}] extras = testing commands = pytest {posargs} @@ -19,3 +19,7 @@ commands = clean: rm -rf docs/_build sphinx-build -nW --keep-going -b {posargs:html} docs/ docs/_build/{posargs:html} + +[flake8] +max-line-length = 100 +extend-ignore = E203,E731