summaryrefslogtreecommitdiff
path: root/src/mfm/parse
diff options
context:
space:
mode:
Diffstat (limited to 'src/mfm/parse')
-rw-r--r--src/mfm/parse/core/syntax-highlighter.ts6
-rw-r--r--src/mfm/parse/elements/hashtag.ts4
2 files changed, 6 insertions, 4 deletions
diff --git a/src/mfm/parse/core/syntax-highlighter.ts b/src/mfm/parse/core/syntax-highlighter.ts
index 2b13608d2b..83aac89f1b 100644
--- a/src/mfm/parse/core/syntax-highlighter.ts
+++ b/src/mfm/parse/core/syntax-highlighter.ts
@@ -1,3 +1,5 @@
+import { capitalize, toUpperCase } from "../../../prelude/string";
+
function escape(text: string) {
return text
.replace(/>/g, '>')
@@ -89,8 +91,8 @@ const _keywords = [
];
const keywords = _keywords
- .concat(_keywords.map(k => k[0].toUpperCase() + k.substr(1)))
- .concat(_keywords.map(k => k.toUpperCase()))
+ .concat(_keywords.map(capitalize))
+ .concat(_keywords.map(toUpperCase))
.sort((a, b) => b.length - a.length);
const symbols = [
diff --git a/src/mfm/parse/elements/hashtag.ts b/src/mfm/parse/elements/hashtag.ts
index f4b6a78fa8..339026228a 100644
--- a/src/mfm/parse/elements/hashtag.ts
+++ b/src/mfm/parse/elements/hashtag.ts
@@ -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]