diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2017-02-11 23:41:57 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2017-02-11 23:41:57 +0900 |
| commit | fa70c40b339e539800c48bd7821b47b0edc6e161 (patch) | |
| tree | 0ba5e17c8ca06c976a910c4ca9f874376e6c1f36 /src/common | |
| parent | [Client] Fix bug (diff) | |
| download | misskey-fa70c40b339e539800c48bd7821b47b0edc6e161.tar.gz misskey-fa70c40b339e539800c48bd7821b47b0edc6e161.tar.bz2 misskey-fa70c40b339e539800c48bd7821b47b0edc6e161.zip | |
インラインコードを実装
Diffstat (limited to 'src/common')
| -rw-r--r-- | src/common/text/elements/inline-code.js | 14 | ||||
| -rw-r--r-- | src/common/text/index.js | 3 |
2 files changed, 16 insertions, 1 deletions
diff --git a/src/common/text/elements/inline-code.js b/src/common/text/elements/inline-code.js new file mode 100644 index 0000000000..d117c53a15 --- /dev/null +++ b/src/common/text/elements/inline-code.js @@ -0,0 +1,14 @@ +/** + * Code (inline) + */ + +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() + }; +}; diff --git a/src/common/text/index.js b/src/common/text/index.js index d0ef8674b0..9da3a26b91 100644 --- a/src/common/text/index.js +++ b/src/common/text/index.js @@ -7,7 +7,8 @@ const elements = [ require('./elements/url'), require('./elements/mention'), require('./elements/hashtag'), - require('./elements/code') + require('./elements/code'), + require('./elements/inline-code') ]; function analyze(source) { |