Allow dashes and undescores in hashtags

This commit is contained in:
Bojan Mojsilovic 2024-03-18 17:56:35 +01:00
parent cc5d5de285
commit ca79d824cc
2 changed files with 3 additions and 2 deletions

View File

@ -40,7 +40,7 @@ import { hookForDev } from '../../lib/devTools';
import { getMediaUrl as getMediaUrlDefault } from "../../lib/media";
import NoteImage from '../NoteImage/NoteImage';
import { createStore, unwrap } from 'solid-js/store';
import { linebreakRegex, shortMentionInWords, shortNoteWords, specialCharsRegex, urlExtractRegex } from '../../constants';
import { hashtagCharsRegex, linebreakRegex, shortMentionInWords, shortNoteWords, specialCharsRegex, urlExtractRegex } from '../../constants';
import { useIntl } from '@cookbook/solid-intl';
import { actions } from '../../translations';
@ -991,7 +991,7 @@ const ParsedNote: Component<{
let [_, term] = token.split('#');
let end = '';
let match = specialCharsRegex.exec(term);
let match = hashtagCharsRegex.exec(term);
if (match) {
const i = match.index;

View File

@ -262,6 +262,7 @@ export const profileRegexG = /nostr:((npub|nprofile)1\w+)\b/g;
export const editMentionRegex = /(?:\s|^)@\`(.*?)\`/ig;
export const specialCharsRegex = /[^A-Za-z0-9]/;
export const hashtagCharsRegex = /[^A-Za-z0-9\-\_]/;
// How long, in words, should a short note be
export const shortNoteWords = 200;