-
Notifications
You must be signed in to change notification settings - Fork 200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parse tags starting with digits and containing spaces (close #1072) #1116
Conversation
592fc64
to
ad1a022
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added a few comments, but looking forward to get this in!
common/markdown_parser/parser.ts
Outdated
@@ -594,6 +594,32 @@ const Hashtag = regexParser( | |||
}, | |||
); | |||
|
|||
/** Extract the name from hashtag text, removing # prefix and <angle brackets> if necessary */ | |||
export function hashtagName(text: string): string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about extractHashtag
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. There is another function extractHashTags
in the same place, which operates on a tree. Should we do anything to prevent confusion? I didn't touch it so far, to not make more changes than necessary
Includes tests and Markdown/Hashtags page for website. Closes silverbulletmd#1072
ad1a022
to
5712486
Compare
@@ -4,6 +4,7 @@ import { | |||
type ParseTree, | |||
traverseTree, | |||
} from "@silverbulletmd/silverbullet/lib/tree"; | |||
import { tagRegex } from "$common/markdown_parser/constants.ts"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The problem we have now is that this means that $common
needs to be defined in any plug's import map relying on this file, which will be the case for all the builtins, but not for external plugs. Two options: either move the constant into plug-api/lib (again: I think this very file tags.ts would be fine) or use a relative path: ../../common/markdown_parser/...
instead.
Ok you know what, let me just merge this as it and fix it on main. |
OK, thanks! I'll write down the changes I needed to do here for future PRs |
I hope you're taking a note in SilverBullet. |
I'd suggest to continue discussion in #1072