[noImplicitAny: true] src/text

This commit is contained in:
rinsuki 2018-06-17 19:55:39 +09:00
parent 871f886702
commit 8c40917cc2
16 changed files with 166 additions and 44 deletions

View file

@ -4,7 +4,14 @@
import genHtml from '../core/syntax-highlighter';
module.exports = text => {
export type TextElementInlineCode = {
type: "inline-code"
content: string
code: string
html: string
};
export default function(text: string) {
const match = text.match(/^`(.+?)`/);
if (!match) return null;
const code = match[0];
@ -13,5 +20,5 @@ module.exports = text => {
content: code,
code: code.substr(1, code.length - 2).trim(),
html: genHtml(code.substr(1, code.length - 2).trim())
};
};
} as TextElementInlineCode;
}