Ignore literal code blocks when making headers

This commit is contained in:
Šarūnas Nejus 2024-12-04 04:16:33 +00:00
parent 6d602effc3
commit 0b905e1b17
No known key found for this signature in database
GPG key ID: DD28F6704DBE3435
2 changed files with 3 additions and 3 deletions

View file

@ -35,7 +35,7 @@ RST_REPLACEMENTS: list[Replacement] = [
MD_REPLACEMENTS: list[Replacement] = [
(r"^ (- )", r"\1"), # remove indent from top-level bullet points
(r"^ +( - )", r"\1"), # adjust nested bullet points indent
(r"^(\w.+?):$", r"### \1"), # make sections headers
(r"^(\w[^\n]+):(?=\n\n[^ ])", r"### \1"), # make sections headers
(r"^- `/?plugins/(\w+)`:?", r"- Plugin **`\1`**:"), # highlight plugins
(r"^- `(\w+)-cmd`:?", r"- Command **`\1`**:"), # highlight commands
(r"### [^\n]+\n+(?=### )", ""), # remove empty sections
@ -142,7 +142,7 @@ def changelog_as_markdown(rst: str) -> str:
md = rst2md(rst)
for pattern, repl in MD_REPLACEMENTS:
md = re.sub(pattern, repl, md, flags=re.M)
md = re.sub(pattern, repl, md, flags=re.M | re.DOTALL)
# order bullet points in each of the lists alphabetically to
# improve readability

View file

@ -69,7 +69,7 @@ def md_changelog():
- Command **`list`**: Update.
- Plugin **`substitute`**: Some substitute multi-line change. :bug: (\#5467)
### You can do something with this command::
You can do something with this command:
$ do-something