mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 18:07:31 -07:00
[MFM] Better hashtag detection
This commit is contained in:
parent
6488a17e60
commit
a498d8d39a
1 changed files with 2 additions and 2 deletions
|
@ -9,9 +9,9 @@ export type TextElementHashtag = {
|
|||
};
|
||||
|
||||
export default function(text: string, i: number) {
|
||||
if (!(/^\s#[^\s\.,!\?]+/.test(text) || (i == 0 && /^#[^\s\.,!\?]+/.test(text)))) return null;
|
||||
if (!(/^\s#[^\s\.,!\?#]+/.test(text) || (i == 0 && /^#[^\s\.,!\?#]+/.test(text)))) return null;
|
||||
const isHead = text.startsWith('#');
|
||||
const hashtag = text.match(/^\s?#[^\s\.,!\?]+/)[0];
|
||||
const hashtag = text.match(/^\s?#[^\s\.,!\?#]+/)[0];
|
||||
const res: any[] = !isHead ? [{
|
||||
type: 'text',
|
||||
content: text[0]
|
||||
|
|
Loading…
Reference in a new issue