标题锚点可以是数字开头

This commit is contained in:
xiaoqi.cxq 2023-06-30 11:28:00 +08:00
parent 282b546edc
commit 81612deab7

View File

@ -65,7 +65,9 @@ export default (md) => {
let i;
for (i = 0; i < slug.length; i += 1) {
const charCode = slug.charCodeAt(i);
if ((charCode >= 0x61 && charCode <= 0x7A) || charCode > 0x7E) {
if ((charCode >= 0x30 && charCode <= 0x39) || // 0-9
(charCode >= 0x61 && charCode <= 0x7A) || // a-z
charCode > 0x7E) {
break;
}
}