Skip to content

Commit b7a945e

Browse files
authored
fix(tags): Dont consume a space before content tags (#1706)
1 parent dc3323b commit b7a945e

File tree

1 file changed

+2
-2
lines changed
  • quartz/plugins/transformers

1 file changed

+2
-2
lines changed

quartz/plugins/transformers/ofm.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ const commentRegex = new RegExp(/%%[\s\S]*?%%/g)
121121
// from https://github.com/escwxyz/remark-obsidian-callout/blob/main/src/index.ts
122122
const calloutRegex = new RegExp(/^\[\!([\w-]+)\|?(.+?)?\]([+-]?)/)
123123
const calloutLineRegex = new RegExp(/^> *\[\!\w+\|?.*?\][+-]?.*$/gm)
124-
// (?:^| ) -> non-capturing group, tag should start be separated by a space or be the start of the line
124+
// (?<=^| ) -> a lookbehind assertion, tag should start be separated by a space or be the start of the line
125125
// #(...) -> capturing group, tag itself must start with #
126126
// (?:[-_\p{L}\d\p{Z}])+ -> non-capturing group, non-empty string of (Unicode-aware) alpha-numeric characters and symbols, hyphens and/or underscores
127127
// (?:\/[-_\p{L}\d\p{Z}]+)*) -> non-capturing group, matches an arbitrary number of tag strings separated by "/"
128128
const tagRegex = new RegExp(
129-
/(?:^| )#((?:[-_\p{L}\p{Emoji}\p{M}\d])+(?:\/[-_\p{L}\p{Emoji}\p{M}\d]+)*)/gu,
129+
/(?<=^| )#((?:[-_\p{L}\p{Emoji}\p{M}\d])+(?:\/[-_\p{L}\p{Emoji}\p{M}\d]+)*)/gu,
130130
)
131131
const blockReferenceRegex = new RegExp(/\^([-_A-Za-z0-9]+)$/g)
132132
const ytLinkRegex = /^.*(youtu.be\/|v\/|u\/\w\/|embed\/|watch\?v=|\&v=)([^#\&\?]*).*/

0 commit comments

Comments
 (0)