Skip to content
This repository was archived by the owner on Oct 16, 2025. It is now read-only.

Commit 9e8d644

Browse files
authored
⬆️ UPGRADE: mdformat v0.5 (#3)
* Remove list conversions * Fix a type annotation
1 parent c2855ea commit 9e8d644

File tree

3 files changed

+13
-19
lines changed

3 files changed

+13
-19
lines changed

mdformat_tables/plugin.py

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def update_mdit(mdit: MarkdownIt) -> None:
1212

1313

1414
def _parse_cells(
15-
rows: List[List[Token]], renderer: MDRenderer, options: dict, env: dict
15+
rows: List[List[List[Token]]], renderer: MDRenderer, options: dict, env: dict
1616
) -> List[List[str]]:
1717
"""Convert tokens in each cell to strings."""
1818
for i, row in enumerate(rows):
@@ -36,33 +36,27 @@ def _to_string(rows: List[List[str]], align: List[str], widths: dict) -> List[st
3636
lines.append(
3737
"| "
3838
+ " | ".join(
39-
[
40-
f"{{:{al or '<'}{widths[i]}}}".format(text)
41-
for i, (text, al) in enumerate(zip(rows[0], align[0]))
42-
]
39+
f"{{:{al or '<'}{widths[i]}}}".format(text)
40+
for i, (text, al) in enumerate(zip(rows[0], align[0]))
4341
)
4442
+ " |"
4543
)
4644
lines.append(
4745
"| "
4846
+ " | ".join(
49-
[
50-
(":" if al in ("<", "^") else "-")
51-
+ "-" * (widths[i] - 2)
52-
+ (":" if al in (">", "^") else "-")
53-
for i, al in enumerate(align[0])
54-
]
47+
(":" if al in ("<", "^") else "-")
48+
+ "-" * (widths[i] - 2)
49+
+ (":" if al in (">", "^") else "-")
50+
for i, al in enumerate(align[0])
5551
)
5652
+ " |"
5753
)
5854
for row, als in zip(rows[1:], align[1:]):
5955
lines.append(
6056
"| "
6157
+ " | ".join(
62-
[
63-
f"{{:{al or '<'}{widths[i]}}}".format(text)
64-
for i, (text, al) in enumerate(zip(row, als))
65-
]
58+
f"{{:{al or '<'}{widths[i]}}}".format(text)
59+
for i, (text, al) in enumerate(zip(row, als))
6660
)
6761
+ " |"
6862
)

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ classifiers = [
1717
keywords = "mdformat,markdown,markdown-it"
1818

1919
requires-python=">=3.6"
20-
requires=["mdformat~=0.3.2"]
20+
requires=["mdformat>=0.3.2,<0.6.0"]
2121

2222
[tool.flit.metadata.requires-extra]
2323
test = [

tests/fixtures.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@ nested syntax
4848
- | -
4949
`c` | [d](link)
5050
.
51-
| *a* | [b](<link>) |
52-
| --- | ----------- |
53-
| `c` | [d](<link>) |
51+
| *a* | [b](link) |
52+
| --- | --------- |
53+
| `c` | [d](link) |
5454
.
5555

5656
paragraph before/after

0 commit comments

Comments
 (0)