Skip to content

Commit 5cad013

Browse files
committed
use _parse_md function
1 parent a07ea45 commit 5cad013

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

bin/check-all-md.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
from pathlib import Path
22
import os
3-
import re
43
import sys
4+
from run_markdown import _parse_md
55

6-
PAT = re.compile(r"^```python\n(.+?)\n```", re.MULTILINE | re.DOTALL)
76
TMP_FILE = "tmp.py"
87

98
for filename in sys.argv[1:]:
109
content = Path(filename).read_text()
11-
blocks = PAT.findall(content)
12-
for i, b in enumerate(blocks):
13-
Path(TMP_FILE).write_text(b.strip())
10+
blocks = _parse_md(content)
11+
for i, block in enumerate(blocks):
12+
Path(TMP_FILE).write_text(block["code"].strip())
1413
sys.stdout.write(f"\n{'=' * 40}\n{filename}: {i}\n")
1514
sys.stdout.flush()
1615
sys.stdout.write(f"{'-' * 40}\n")

0 commit comments

Comments
 (0)