Skip to content

Commit a78a1ef

Browse files
committed
build: copier-auto-update
1 parent 22b1ae9 commit a78a1ef

9 files changed

Lines changed: 174 additions & 66 deletions

File tree

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# Answer file maintained by Copier for: https://github.com/KyleKing/mdformat-plugin-template
33
# DO NOT MODIFY THIS FILE. Edit by re-running copier and changing responses to the questions
44
# Check into version control.
5-
_commit: 1.1.5
5+
_commit: 2.1.2
66
_src_path: gh:KyleKing/mdformat-plugin-template
77
author_email: dev.act.kyle@gmail.com
88
author_name: Kyle King

.github/workflows/tests.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,26 @@ name: CI
88
pull_request: null
99

1010
jobs:
11-
pre-commit:
11+
prek:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v4
14+
- uses: actions/checkout@v5
1515
- name: Set up Python
16-
uses: actions/setup-python@v5
16+
uses: actions/setup-python@v6
1717
with:
1818
python-version: 3.12
19-
- uses: pre-commit/action@v3.0.1
19+
- uses: j178/prek-action@v1
2020

2121
tests:
2222
runs-on: ${{ matrix.os }}
2323
strategy:
2424
matrix:
25-
python-version: [3.9, 3.12]
25+
python-version: ["3.10", "3.12"]
2626
os: [ubuntu-latest, windows-latest]
2727
steps:
28-
- uses: actions/checkout@v4
28+
- uses: actions/checkout@v5
2929
- name: Set up Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@v5
30+
uses: actions/setup-python@v6
3131
with:
3232
python-version: ${{ matrix.python-version }}
3333
- name: Installation (deps and package)
@@ -47,33 +47,33 @@ jobs:
4747
# with:
4848
# token: ${{ secrets.CODECOV_TOKEN }}
4949

50-
pre-commit-hook:
50+
prek-hook:
5151
runs-on: ubuntu-latest
5252
steps:
53-
- uses: actions/checkout@v4
53+
- uses: actions/checkout@v5
5454
- name: Set up Python
55-
uses: actions/setup-python@v5
55+
uses: actions/setup-python@v6
5656
with:
5757
python-version: 3.12
5858
- name: Installation (deps and package)
59+
uses: j178/prek-action@v1
60+
with:
61+
install-only: true
62+
- name: run prek with plugin
5963
run: |
60-
pipx install pre-commit
61-
pip install .
62-
- name: run pre-commit with plugin
63-
run: |
64-
pre-commit run --config .pre-commit-test.yaml --all-files --verbose --show-diff-on-failure
64+
prek run --config .prek-test.yaml --all-files --verbose --show-diff-on-failure
6565
6666
publish:
6767
name: Publish to PyPi
68-
needs: [pre-commit, tests, pre-commit-hook]
68+
needs: [prek, tests, prek-hook]
6969
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
7070
runs-on: ubuntu-latest
7171
# Fix 403 error (https://github.com/softprops/action-gh-release/issues/400)
7272
permissions:
7373
contents: write
7474
steps:
7575
- name: Checkout source
76-
uses: actions/checkout@v4
76+
uses: actions/checkout@v5
7777
- name: install flit
7878
run: |
7979
pipx install flit~=3.10.1

.pre-commit-config.yaml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
repos:
33
- repo: https://github.com/pre-commit/pre-commit-hooks
4-
rev: v5.0.0
4+
rev: v6.0.0
55
hooks:
66
- id: check-added-large-files
77
- id: check-executables-have-shebangs
@@ -26,7 +26,7 @@ repos:
2626
- id: trailing-whitespace
2727
exclude: __snapshots__/.*\.ambr
2828
- repo: https://github.com/executablebooks/mdformat
29-
rev: 0.7.18
29+
rev: 0.7.19
3030
hooks:
3131
- id: mdformat
3232
additional_dependencies:
@@ -36,12 +36,18 @@ repos:
3636
exclude: tests/.+\.md
3737
stages: ["pre-commit"]
3838
- repo: https://github.com/adrienverge/yamllint.git
39-
rev: v1.35.1
39+
rev: v1.37.1
4040
hooks:
4141
- id: yamllint
4242
stages: ["pre-commit"]
43+
- repo: https://github.com/python-jsonschema/check-jsonschema
44+
rev: 0.30.0
45+
hooks:
46+
- id: check-github-workflows
47+
args: ["--verbose"]
48+
stages: ["pre-commit"]
4349
- repo: https://github.com/pappasam/toml-sort
44-
rev: v0.23.1
50+
rev: v0.24.3
4551
hooks:
4652
- id: toml-sort-fix
4753
stages: ["pre-commit"]

.tool-versions

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
python 3.9.13 3.12.5
1+
python 3.10.15 3.12.5

AGENTS.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# AGENTS.md
2+
3+
## Testing
4+
5+
```bash
6+
# Run all tests using tox
7+
tox
8+
9+
# Run tests with coverage (Python 3.10)
10+
tox -e py310-test
11+
12+
# Run tests with coverage (Python 3.12)
13+
tox -e py312-test
14+
15+
# Run specific tests with pytest flags
16+
tox -e py312-test -- --exitfirst --failed-first --new-first -vv --snapshot-update
17+
```
18+
19+
## Linting and Formatting
20+
21+
```bash
22+
# Run all pre-commit hooks (using prek)
23+
tox -e py312-prek
24+
# Or run directly with prek
25+
prek run --all
26+
27+
# Run ruff for linting and formatting
28+
tox -e py312-ruff
29+
# With unsafe fixes
30+
tox -e py312-ruff -- --unsafe-fixes
31+
```
32+
33+
## Type Checking
34+
35+
```bash
36+
# Run mypy type checking
37+
tox -e py312-type
38+
```
39+
40+
## Pre-commit Hook Testing
41+
42+
```bash
43+
# Test the plugin as a pre-commit hook
44+
tox -e py310-hook
45+
```
46+
47+
## Architecture
48+
49+
### Plugin System
50+
51+
The package implements mdformat's plugin interface with up to four key exports in `__init__.py`:
52+
53+
- `update_mdit`: Registers markdown-it parser extensions
54+
- `add_cli_argument_group`: Optionally adds CLI flags
55+
- `RENDERERS`: Maps syntax tree node types to render functions
56+
- `POSTPROCESSORS`: Post-processes rendered output (list normalization, inline wrapping, deflist escaping)
57+
58+
### Core Components
59+
60+
**mdformat_obsidian/plugin.py**
61+
62+
- Entry point that configures the mdformat plugin, registers all mdit_plugins, defines custom renders, and handles CLI configuration options
63+
64+
### Configuration Options
65+
66+
Configuration can be passed via:
67+
68+
1. Example CLI arguments: `--cli-argument`
69+
1. Example TOML config file (`.mdformat.toml`):
70+
```toml
71+
[plugin.obsidian]
72+
cli_argument = true
73+
```
74+
1. API: `mdformat.text(content, extensions={"obsidian"}, options={...})`
75+
76+
### Testing Strategy
77+
78+
**Snapshot Testing**
79+
80+
- Test fixtures in `tests/format/fixtures/` and `tests/render/fixtures/`
81+
- Main test file: `tests/test_mdformat.py` verifies idempotent formatting against `tests/pre-commit-test.md`
82+
83+
**Test Organization**
84+
85+
- `tests/format/`: Tests formatting output (input markdown → formatted markdown)
86+
- `tests/render/`: Tests HTML rendering (markdown → HTML via markdown-it)
87+
88+
## Development Notes
89+
90+
- This project uses `flit` as the build backend
91+
- Uses `tox` for test automation with multiple Python versions (3.10, 3.12)
92+
- Pre-commit is configured but the project now uses `prek` (faster alternative)
93+
- Python 3.10+ is required (see `requires-python` in `pyproject.toml`)
94+
- Version is defined in `mdformat_obsidian/__init__.py` as `__version__`

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@AGENTS.md

CONTRIBUTING.md

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ This package utilizes [flit](https://flit.readthedocs.io) as the build engine, a
1414
To install these development dependencies:
1515

1616
```bash
17-
pipx install tox
18-
# or: uv tool install tox --with tox-uv
17+
uv tool install tox --with tox-uv
18+
# or: pipx install tox
1919
```
2020

2121
To run the tests:
@@ -27,7 +27,7 @@ tox
2727
and with test coverage:
2828

2929
```bash
30-
tox -e py39-cov
30+
tox -e py310-test
3131
```
3232

3333
The easiest way to write tests, is to edit `tests/fixtures.md`
@@ -38,42 +38,45 @@ To run the code formatting and style checks:
3838
tox -e py312-pre-commit
3939
```
4040

41-
or directly
41+
or directly with [prek](https://github.com/j178/prek) (or pre-commit)
4242

4343
```bash
44-
pipx install pre-commit
45-
# or: uv tool install pre-commit
46-
pre-commit run --all
44+
uv tool install prek
45+
# or: pipx install prek, brew install prek, etc.
46+
47+
prek install -f
48+
prek run --all
4749
```
4850

4951
To run the pre-commit hook test:
5052

5153
```bash
52-
tox -e py39-hook
54+
tox -e py310-hook
5355
```
5456

5557
## `ptw` testing
5658

5759
See configuration in `pyproject.toml` for `[tool.pytest-watcher]`
5860

5961
```sh
60-
pipx install pytest-watcher
62+
uv tool install pytest-watcher
63+
# or: pipx install pytest-watcher
6164

6265
ptw .
6366
```
6467

65-
## Local pipx testing
68+
## Local uv/pipx testing
6669

67-
Run the latest local code anywhere with pipx.
70+
Run the latest local code anywhere with uv tool.
6871

6972
```sh
70-
pipx install . --include-deps --force --editable
73+
uv tool install . --editable --force --with="mdformat>=0.7.19"
7174
```
7275

73-
Or with uv:
76+
Or with pipx:
7477

7578
```sh
76-
uv tool install mdformat --force --with-editable=.
79+
pipx install . --include-deps --force --editable
7780
```
7881

7982
## Publish to PyPi

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ Add this package wherever you use `mdformat` and the plugin will be auto-recogni
2525
- [mdformat-config](https://pypi.org/project/mdformat-config)
2626
- [mdformat-frontmatter](https://pypi.org/project/mdformat-frontmatter)
2727
- [mdformat-simple-breaks](https://pypi.org/project/mdformat-simple-breaks)
28-
- [mdformat-tables](https://pypi.org/project/mdformat-tables)
2928
- [mdformat-web](https://pypi.org/project/mdformat-web)
3029
- [mdformat-wikilink](https://github.com/tmr232/mdformat-wikilink)
3130

0 commit comments

Comments
 (0)