Skip to content
This repository was archived by the owner on Nov 23, 2026. It is now read-only.

Commit e254e14

Browse files
committed
Escape PR numbers at the start of list items
1 parent 99965fe commit e254e14

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

‎admin/filters/class_reference.php‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,12 @@ function before_filter_class_reference(string $data, string $folder): string
116116

117117
function after_filter_class_reference(string $data, string $folder): string
118118
{
119-
return str_replace('\#', '#', $data);
119+
$data = str_replace('\#', '#', $data);
120+
121+
// Python-Markdown reads "#1361" in list text as a heading even without a space.
122+
return preg_replace_callback('/^(\h*(?:[-+*]|\d+[.)])\h+)(#+)(?=[^\s#])/m', function (array $matches): string {
123+
return $matches[1] . '\\' . $matches[2];
124+
}, $data);
120125
}
121126

122127
function remove_indent_level(string $data, string $indent): string

0 commit comments

Comments
 (0)