summaryrefslogtreecommitdiff
path: root/src/text/parse/elements/inline-code.ts
diff options
context:
space:
mode:
authorha-dai <contact@haradai.net>2018-05-04 02:49:46 +0900
committerha-dai <contact@haradai.net>2018-05-04 02:49:46 +0900
commitf850283147072c681df1b39c57f8bd0b14f18016 (patch)
tree63ff533c91097da2d8ca2070fc67a28f67ee33da /src/text/parse/elements/inline-code.ts
parentMerge branch 'master' of github.com:syuilo/misskey (diff)
parent1.7.0 (diff)
downloadmisskey-f850283147072c681df1b39c57f8bd0b14f18016.tar.gz
misskey-f850283147072c681df1b39c57f8bd0b14f18016.tar.bz2
misskey-f850283147072c681df1b39c57f8bd0b14f18016.zip
Merge branch 'master' of github.com:syuilo/misskey
Diffstat (limited to 'src/text/parse/elements/inline-code.ts')
-rw-r--r--src/text/parse/elements/inline-code.ts17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/text/parse/elements/inline-code.ts b/src/text/parse/elements/inline-code.ts
new file mode 100644
index 0000000000..9f9ef51a2b
--- /dev/null
+++ b/src/text/parse/elements/inline-code.ts
@@ -0,0 +1,17 @@
+/**
+ * Code (inline)
+ */
+
+import genHtml from '../core/syntax-highlighter';
+
+module.exports = text => {
+ const match = text.match(/^`(.+?)`/);
+ if (!match) return null;
+ const code = match[0];
+ return {
+ type: 'inline-code',
+ content: code,
+ code: code.substr(1, code.length - 2).trim(),
+ html: genHtml(code.substr(1, code.length - 2).trim())
+ };
+};