diff --git a/src/autolinker.ts b/src/autolinker.ts index 1e924a5a..5779ade5 100644 --- a/src/autolinker.ts +++ b/src/autolinker.ts @@ -145,11 +145,11 @@ function isCommonAbstractOp(op: string) { function lookAheadBeyond(key: string, entry: BiblioEntry) { if (isCommonAbstractOp(key)) { // must be followed by parentheses - return '\\b(?=\\()'; + return '(?=\\()'; } if (entry.type !== 'term' || /^\w/.test(key)) { - // must not be followed by `.word` or `%%` or `]]` - return '\\b(?!\\.\\w|%%|\\]\\])'; + // must not be followed by a letter, `.word`, `%%`, `]]` + return '(?!\\w|\\.\\w|%%|\\]\\])'; } return ''; } diff --git a/test/baselines/generated-reference/autolinking.html b/test/baselines/generated-reference/autolinking.html index 2705493b..f1f8fe75 100644 --- a/test/baselines/generated-reference/autolinking.html +++ b/test/baselines/generated-reference/autolinking.html @@ -17,6 +17,7 @@

1 Autolinking

extra spaces

Await

Variants

+

𝔽(x)

2 Autolinking 2

@@ -29,6 +30,7 @@

2 Autolinking 2

Also, no autolinks in anchors: Lowercase.

Similarly, no autolinks for [Await].

Variants like vOne and vTwo should autolink, including when capitalized as in VOne.

+
  1. Non-word-chars AOs still link when invoked, like 𝔽(x).

%Array% and %ArrayPrototype% outside of clauses is ok.

\ No newline at end of file diff --git a/test/baselines/sources/autolinking.html b/test/baselines/sources/autolinking.html index bb790600..e4c1f559 100644 --- a/test/baselines/sources/autolinking.html +++ b/test/baselines/sources/autolinking.html @@ -14,6 +14,7 @@

Autolinking

extra spaces

Await

Variants

+

𝔽(_x_)

Autolinking 2

@@ -26,5 +27,8 @@

Autolinking 2

Also, no autolinks in anchors: Lowercase.

Similarly, no autolinks for [Await].

Variants like vOne and vTwo should autolink, including when capitalized as in VOne.

+ + 1. Non-word-chars AOs still link when invoked, like 𝔽(_x_). +

%Array% and %ArrayPrototype% outside of clauses is ok.