Add support for ignoring horizontal rules when adding bullet points

This commit is contained in:
Hiroo Takizawa 2025-03-23 20:49:50 +09:00
parent 8526811bcd
commit 2846556070

View file

@ -200,6 +200,14 @@ export default class AutoBulletPlugin extends Plugin {
return;
}
// Check if the line is a horizontal rule (---, ***, ___)
const isHorizontalRule = /^\s*([-]{3,}|[*]{3,}|[_]{3,})\s*$/.test(line);
// If the line is a horizontal rule, do not add bullet points
if (isHorizontalRule) {
return;
}
// Check if the last character typed was a space (half-width or full-width) or tab
// and if the corresponding setting is enabled
if ((lastChar === ' ' && this.settings.enableHalfWidthSpace) ||