Skip to content

Commit 26b7e50

Browse files
committed
fix missing blank line in lists
1 parent cc6bf47 commit 26b7e50

File tree

2 files changed

+26
-6
lines changed

2 files changed

+26
-6
lines changed

build.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@ def clone(branch: str, tmp_dir: str) -> None:
2626
def build_manpages(tmp_dir: str):
2727
if return_code := subprocess.run(["sh", "config"], cwd=tmp_dir).returncode != 0:
2828
raise SystemExit(return_code)
29-
if (
30-
return_code := subprocess.run(["make", "-j", str(os.cpu_count()), "build_man_docs"], cwd=tmp_dir).returncode
31-
!= 0
32-
):
29+
cmd = ["make", "-j", str(os.cpu_count()), "build_man_docs"]
30+
if return_code := subprocess.run(cmd, cwd=tmp_dir).returncode != 0:
3331
raise SystemExit(return_code)
3432

3533

@@ -49,7 +47,7 @@ def convert_pod_to_md(tmp_dir: str):
4947
dir_map = {
5048
"apps": "man1",
5149
"crypto": "man3",
52-
"ssl": "man7",
50+
"ssl": "man3",
5351
"man1": "man1",
5452
"man3": "man3",
5553
"man5": "man5",

hooks.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,9 @@
44
import marko
55
import minify_html
66
from marko.block import Heading
7+
from marko.block import ListItem
78
from marko.block import Paragraph
9+
from marko.helpers import MarkoExtension
810
from marko.inline import Link as MarkdownLink
911
from marko.md_renderer import MarkdownRenderer
1012
from mkdocs import plugins
@@ -19,6 +21,26 @@
1921
LINKS_MAP = {}
2022

2123

24+
class HackedListItem(ListItem):
25+
26+
override = True
27+
28+
@classmethod
29+
def parse(cls, source) -> ListItem:
30+
state = cls(source.context.list_item_info)
31+
state.children = []
32+
with source.under_state(state):
33+
if not source.next_line().strip():
34+
source.consume()
35+
if not source.next_line() or not source.next_line().strip():
36+
return state
37+
state.children = source.parser.parse_source(source)
38+
return state
39+
40+
41+
HackExtension = MarkoExtension(elements=[HackedListItem])
42+
43+
2244
def get_names_paragraph(content: str) -> str:
2345
paragraph_lines = []
2446
append = False
@@ -102,7 +124,7 @@ def fix_heading(heading: Heading, parser: marko.Markdown) -> Heading:
102124
def fix_markdown(source_md: str, page: Page, config: MkDocsConfig, files: Files) -> str:
103125
if page.file.src_uri in SKIP_FILES + MAN_INDEXES:
104126
return source_md
105-
parser = marko.Markdown(renderer=MarkdownRenderer)
127+
parser = marko.Markdown(renderer=MarkdownRenderer, extensions=[HackExtension])
106128
new_children = []
107129
h1_parsed = parser.parse(f"# {page.file.name}")
108130
h1 = h1_parsed.children[0]

0 commit comments

Comments
 (0)