summaryrefslogtreecommitdiff
path: root/src/mfm/parse
diff options
context:
space:
mode:
authorsyuilo <Syuilotan@yahoo.co.jp>2018-08-30 03:56:51 +0900
committerGitHub <noreply@github.com>2018-08-30 03:56:51 +0900
commit4e11da98d90c1c44fce1abaf63c248896feff03a (patch)
treecbe91363f87a3cc29b142433c16e4b16ccf2aa7d /src/mfm/parse
parentNew translations ja-JP.yml (French) (diff)
parent:art: (diff)
downloadmisskey-4e11da98d90c1c44fce1abaf63c248896feff03a.tar.gz
misskey-4e11da98d90c1c44fce1abaf63c248896feff03a.tar.bz2
misskey-4e11da98d90c1c44fce1abaf63c248896feff03a.zip
Merge branch 'develop' into l10n_develop
Diffstat (limited to 'src/mfm/parse')
-rw-r--r--src/mfm/parse/core/syntax-highlighter.ts2
-rw-r--r--src/mfm/parse/elements/hashtag.ts2
-rw-r--r--src/mfm/parse/elements/link.ts2
3 files changed, 3 insertions, 3 deletions
diff --git a/src/mfm/parse/core/syntax-highlighter.ts b/src/mfm/parse/core/syntax-highlighter.ts
index 3fb7a3b73d..2b13608d2b 100644
--- a/src/mfm/parse/core/syntax-highlighter.ts
+++ b/src/mfm/parse/core/syntax-highlighter.ts
@@ -197,7 +197,7 @@ const elements: Element[] = [
if (thisIsNotARegexp) return null;
if (regexp == '') return null;
- if (regexp[0] == ' ' && regexp[regexp.length - 1] == ' ') return null;
+ if (regexp.startsWith(' ') && regexp.endsWith(' ')) return null;
return {
html: `<span class="regexp">/${escape(regexp)}/</span>`,
diff --git a/src/mfm/parse/elements/hashtag.ts b/src/mfm/parse/elements/hashtag.ts
index 129041774f..f4b6a78fa8 100644
--- a/src/mfm/parse/elements/hashtag.ts
+++ b/src/mfm/parse/elements/hashtag.ts
@@ -10,7 +10,7 @@ export type TextElementHashtag = {
export default function(text: string, i: number) {
if (!(/^\s#[^\s]+/.test(text) || (i == 0 && /^#[^\s]+/.test(text)))) return null;
- const isHead = text[0] == '#';
+ const isHead = text.startsWith('#');
const hashtag = text.match(/^\s?#[^\s]+/)[0];
const res: any[] = !isHead ? [{
type: 'text',
diff --git a/src/mfm/parse/elements/link.ts b/src/mfm/parse/elements/link.ts
index b353aebc5c..796aeb1ab3 100644
--- a/src/mfm/parse/elements/link.ts
+++ b/src/mfm/parse/elements/link.ts
@@ -13,7 +13,7 @@ export type TextElementLink = {
export default function(text: string) {
const match = text.match(/^\??\[([^\[\]]+?)\]\((https?:\/\/[\w\/:%#@\$&\?!\(\)\[\]~\.=\+\-]+?)\)/);
if (!match) return null;
- const silent = text[0] == '?';
+ const silent = text.startsWith('?');
const link = match[0];
const title = match[1];
const url = match[2];