diff options
Diffstat (limited to 'src/mfm')
| -rw-r--r-- | src/mfm/html.ts | 5 | ||||
| -rw-r--r-- | src/mfm/parse/core/syntax-highlighter.ts | 6 |
2 files changed, 5 insertions, 6 deletions
diff --git a/src/mfm/html.ts b/src/mfm/html.ts index 2e38fe10a0..b7fa5b6f03 100644 --- a/src/mfm/html.ts +++ b/src/mfm/html.ts @@ -4,10 +4,7 @@ const { JSDOM } = jsdom; import config from '../config'; import { INote } from '../models/note'; import { TextElement } from './parse'; - -function intersperse<T>(sep: T, xs: T[]): T[] { - return [].concat(...xs.map(x => [sep, x])).slice(1); -} +import { intersperse } from '../prelude/array'; const handlers: { [key: string]: (window: any, token: any, mentionedRemoteUsers: INote['mentionedRemoteUsers']) => void } = { bold({ document }, { bold }) { 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 = [ |