summaryrefslogtreecommitdiff
path: root/src/text/parse/elements
diff options
context:
space:
mode:
Diffstat (limited to 'src/text/parse/elements')
-rw-r--r--src/text/parse/elements/title.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/text/parse/elements/title.ts b/src/text/parse/elements/title.ts
new file mode 100644
index 0000000000..9f4708f5d6
--- /dev/null
+++ b/src/text/parse/elements/title.ts
@@ -0,0 +1,14 @@
+/**
+ * Title
+ */
+
+module.exports = text => {
+ const match = text.match(/^【(.+?)】\n/);
+ if (!match) return null;
+ const title = match[0];
+ return {
+ type: 'title',
+ content: title,
+ title: title.substr(1, title.length - 3)
+ };
+};