summaryrefslogtreecommitdiff
path: root/src/text/parse/elements/inline-code.ts
diff options
context:
space:
mode:
authorAkihiko Odaki <nekomanma@pixiv.co.jp>2018-04-02 12:58:53 +0900
committerAkihiko Odaki <nekomanma@pixiv.co.jp>2018-04-02 12:58:53 +0900
commit5b9f3701f58ca00c151498d16b6a839a91ba8643 (patch)
treed32620bf206288b204060672a0088b4b0c7fa5eb /src/text/parse/elements/inline-code.ts
parentMerge branch 'master' of https://github.com/syuilo/misskey (diff)
downloadsharkey-5b9f3701f58ca00c151498d16b6a839a91ba8643.tar.gz
sharkey-5b9f3701f58ca00c151498d16b6a839a91ba8643.tar.bz2
sharkey-5b9f3701f58ca00c151498d16b6a839a91ba8643.zip
Abolish common and misc directories
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())
+ };
+};