I use setext headings. When a page title contains a single word followed by a colon, the page renders incorrectly.
Result

Expected
Cause
This title is interpreted by mkdocs as MultiMarkdown Style Meta-Data:
|
# No YAML delimiters. Try MultiMarkdown style |
|
lines = doc.replace('\r\n', '\n').replace('\r', '\n').split('\n') |
|
|
|
key = None |
|
while lines: |
|
line = lines.pop(0) |
|
|
|
if line.strip() == '': |
|
break # blank line - done |
|
if m1 := META_RE.match(line): |
|
key = m1.group('key').lower().strip() |
|
value = m1.group('value').strip() |
|
if key in data: |
|
data[key] += f' {value}' |
|
else: |
|
data[key] = value |
Solution
I'm not sure how this should be fixed without breaking backward compatibility. It might be a good idea to make MultiMarkdown style meta-data an option that can be turned off - in our project we only use YAML style meta-data.
Workaround
All these variants will render correctly:
Atx-style headings:
A space in the text before the colon:
Foo bar: Baz
===
Lorem ipsum
YAML metadata before the title:
---
workaround_mkdocs_colon_in_title: true # actual data doesn't matter, as long as it is valid YAML
---
Foo: Bar
===
Lorem ipsum
I use setext headings. When a page title contains a single word followed by a colon, the page renders incorrectly.
Foo: Bar === Lorem ipsumResult

Expected
Cause
This title is interpreted by mkdocs as MultiMarkdown Style Meta-Data:
mkdocs/mkdocs/utils/meta.py
Lines 76 to 91 in 2862536
Solution
I'm not sure how this should be fixed without breaking backward compatibility. It might be a good idea to make MultiMarkdown style meta-data an option that can be turned off - in our project we only use YAML style meta-data.
Workaround
All these variants will render correctly:
Atx-style headings:
# Foo: Bar Lorem ipsumA space in the text before the colon:
Foo bar: Baz === Lorem ipsumYAML metadata before the title: