File tree 2 files changed +8
-1
lines changed
2 files changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -68,7 +68,11 @@ def process_header_to_fragment(header: str) -> str:
68
68
fragment = fragment .replace (res .group (0 ), res .group (2 ))
69
69
70
70
fragment = fragment .lower ().replace (" " , "-" )
71
- fragment = re .sub (r"[^a-z0-9-_]" , "" , fragment )
71
+
72
+ def filter_header_symbols (c : str ) -> bool :
73
+ return c .isalpha () or c .isdigit () or c in ["-" , "_" ]
74
+
75
+ fragment = "" .join (filter (filter_header_symbols , fragment ))
72
76
return fragment
73
77
74
78
Original file line number Diff line number Diff line change @@ -35,6 +35,9 @@ def test_find_all_markdowns_in_repo():
35
35
("H $ maths $" , "h--maths-" ),
36
36
("H [text](link)" , "h-text" ),
37
37
("H [](link)" , "h-" ),
38
+ ("🙀 header with icon" , "-header-with-icon" ),
39
+ ("דוגמא" , "דוגמא" ),
40
+ ("例子" , "例子" ),
38
41
),
39
42
)
40
43
def test_process_header_to_fragment (header , fragment ):
You can’t perform that action at this time.
0 commit comments