diff --git a/.copier-answers.yml b/.copier-answers.yml index b09afa3..ed19c28 100644 --- a/.copier-answers.yml +++ b/.copier-answers.yml @@ -2,7 +2,7 @@ # Answer file maintained by Copier for: https://github.com/KyleKing/mdformat-plugin-template # DO NOT MODIFY THIS FILE. Edit by re-running copier and changing responses to the questions # Check into version control. -_commit: 1.0.0 +_commit: 1.0.2 _src_path: gh:KyleKing/mdformat-plugin-template author_email: dev.act.kyle@gmail.com author_name: Kyle King diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2763978..3cc20de 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -28,14 +28,16 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Installation (deps and package) - # we install with flit --pth-file, - # so that coverage will be recorded for the module + # We install with flit --pth-file, so that coverage will be recorded for the module + # Flit could be installed with pipx and use '--python=$(which python)', but + # there are issues with the Windows Runner run: | - pipx install flit + pip install flit~=3.9 flit install --deps=production --extras=test --pth-file - name: Run pytest run: | pytest --cov=$(ls | grep "mdformat_" | head) --cov-report=xml --cov-report=term-missing + # Not currently configured # - name: Upload to Codecov # if: matrix.os == 'ubuntu-latest' && matrix.python-version == 3.12 # uses: codecov/codecov-action@v1 @@ -72,7 +74,7 @@ jobs: uses: actions/checkout@v4 - name: install flit run: | - pipx install flit~=3.0 + pipx install flit~=3.9 - name: Build and publish run: | flit publish diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b9c358a..0ad066b 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ --- repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.6.0 + rev: v5.0.0 hooks: - id: check-added-large-files - id: check-executables-have-shebangs @@ -27,14 +27,8 @@ repos: args: [--autofix, --indent=4] - id: trailing-whitespace exclude: __snapshots__/.*\.ambr - - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.6.1 - hooks: - - id: ruff - args: [--fix] - - id: ruff-format - repo: https://github.com/executablebooks/mdformat - rev: 0.7.17 + rev: 0.7.18 hooks: - id: mdformat additional_dependencies: diff --git a/mdformat_mkdocs/plugin.py b/mdformat_mkdocs/plugin.py index f7e86bb..f292673 100644 --- a/mdformat_mkdocs/plugin.py +++ b/mdformat_mkdocs/plugin.py @@ -1,8 +1,8 @@ -"""`mdformat` Plugin.""" +"""Public Extension.""" from __future__ import annotations -import argparse +from argparse import ArgumentParser from collections.abc import Mapping from functools import partial from typing import Any @@ -48,7 +48,7 @@ def cli_is_align_semantic_breaks_in_lists(options: ContextOptions) -> bool: return options["mdformat"].get("align_semantic_breaks_in_lists", False) -def add_cli_options(parser: argparse.ArgumentParser) -> None: +def add_cli_options(parser: ArgumentParser) -> None: """Add options to the mdformat CLI, to be stored in `mdit.options["mdformat"]`.""" parser.add_argument( "--align-semantic-breaks-in-lists", @@ -122,9 +122,9 @@ def _render_cross_reference(node: RenderTreeNode, context: RenderContext) -> str return _render_with_default_renderer(node, context, "link") -# A mapping from `RenderTreeNode.type` to a `Render` function that can -# render the given `RenderTreeNode` type. These override the default -# `Render` funcs defined in `mdformat.renderer.DEFAULT_RENDERERS`. +# A mapping from syntax tree node type to a function that renders it. +# This can be used to overwrite renderer functions of existing syntax +# or add support for new syntax. RENDERERS: Mapping[str, Render] = { "admonition_mkdocs": ADMON_RENDERS["admonition"], "admonition_mkdocs_title": ADMON_RENDERS["admonition_title"],