Skip to content

Commit

Permalink
feat!: support only "-", "•" as listitem prefix
Browse files Browse the repository at this point in the history
"+" and "*" have many false-positives and aren't commonly used as
a listitem prefix.
  • Loading branch information
justinmk committed Mar 5, 2023
1 parent 8f75ef3 commit ef5571a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
// - Rules starting with underscore are hidden in the syntax tree.

const _uppercase_word = /[A-Z0-9.()][-A-Z0-9.()_]+/;
const _li_token = /[-*+•][ ]+/;
const _li_token = /[-•][ ]+/;

module.exports = grammar({
name: 'help', // The actual language name is help
Expand Down Expand Up @@ -43,8 +43,8 @@ module.exports = grammar({
)),
word_noli: ($) => prec(1, choice(
// Lines contained by line_li must not start with a listitem symbol.
token(prec(-1, /[^-*+•\n\t ][^\n\t ]*/)),
token(prec(-1, /[-*+•][^\n\t ]+/)),
token(prec(-1, /[^-•\n\t ][^\n\t ]*/)),
token(prec(-1, /[-•][^\n ]+/)),
choice($._word_common),
)),

Expand Down Expand Up @@ -74,6 +74,8 @@ module.exports = grammar({
'|',
// NOT listitem: "-" or "•" followed by tab.
/[-•]\t/,
// NOT tag:
'*',
// NOT argument:
'{',
'}',
Expand Down

0 comments on commit ef5571a

Please sign in to comment.