diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2018-06-18 14:43:56 +0900 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-06-18 14:43:56 +0900 |
| commit | 5d3943ffa8cb4090c5c111397e266d255cc2212b (patch) | |
| tree | 46f692fb21005bdc89499ea012c2436e8a2e90c0 /src/text/parse/elements/code.ts | |
| parent | New translations ja.yml (Spanish) (diff) | |
| parent | yatta (diff) | |
| download | misskey-5d3943ffa8cb4090c5c111397e266d255cc2212b.tar.gz misskey-5d3943ffa8cb4090c5c111397e266d255cc2212b.tar.bz2 misskey-5d3943ffa8cb4090c5c111397e266d255cc2212b.zip | |
Merge branch 'master' into l10n_master
Diffstat (limited to 'src/text/parse/elements/code.ts')
| -rw-r--r-- | src/text/parse/elements/code.ts | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/text/parse/elements/code.ts b/src/text/parse/elements/code.ts index 4821e95fe2..f48e945048 100644 --- a/src/text/parse/elements/code.ts +++ b/src/text/parse/elements/code.ts @@ -4,7 +4,14 @@ import genHtml from '../core/syntax-highlighter'; -module.exports = text => { +export type TextElementCode = { + type: 'code' + content: string + code: string + html: string +}; + +export default function(text: string) { const match = text.match(/^```([\s\S]+?)```/); if (!match) return null; const code = match[0]; @@ -13,5 +20,5 @@ module.exports = text => { content: code, code: code.substr(3, code.length - 6).trim(), html: genHtml(code.substr(3, code.length - 6).trim()) - }; -}; + } as TextElementCode; +} |