diff --git a/src/markd/core.js b/src/markd/core.js
index 295b5d8..a33ceb9 100644
--- a/src/markd/core.js
+++ b/src/markd/core.js
@@ -9,6 +9,22 @@ const HR_LIST = ['=', '-', '_', '*']
const LIST_REG = /^(([\+\-\*])|(\d+\.))\s/
const TODO_REG = /^\-\s\[(x|\s)\]\s/
const ESCAPE_REG = /\\([-+*_`])/g
+
+const INLINE = {
+ strong: [
+ /__([^\s_])__(?!_)/g,
+ /\*\*([^\s*])\*\*(?!\*)/g,
+ /__([^\s][\s\S]*?[^\s])__(?!_)/g,
+ /\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/g
+ ],
+ em: [
+ /_([^\s_])_(?!_)/g,
+ /\*([^\s*])\*(?!\*)/g,
+ /_([^\s][\s\S]*?[^\s])_(?!_)/g,
+ /\*([^\s][\s\S]*?[^\s])\*(?!\*)/g
+ ],
+ del: [/~~([^\~])~~(?!~)/g, /~~([^\s][\s\S]*?[^\s])~~(?!~)/g]
+}
const log = console.log
const Helper = {
@@ -53,10 +69,17 @@ const Decoder = {
// 内联样式
inline(str) {
return str
- .replace(/`(.*?[^\\])`/g, '$1
')
- .replace(/(__|\*\*)(.*?[^\\])\1/g, '$2')
- .replace(/\b(_|\*)(.*?[^\\])\1\b/g, '$2')
- .replace(/~~(.*?[^\\])~~/g, '$1')
+ .replace(/`([^`]*?[^`\\\s])`/g, '$1
')
+ .replace(INLINE.strong[0], '$1')
+ .replace(INLINE.strong[1], '$1')
+ .replace(INLINE.strong[2], '$1')
+ .replace(INLINE.strong[3], '$1')
+ .replace(INLINE.em[0], '$1')
+ .replace(INLINE.em[1], '$1')
+ .replace(INLINE.em[2], '$1')
+ .replace(INLINE.em[3], '$1')
+ .replace(INLINE.del[0], '$1')
+ .replace(INLINE.del[1], '$1')
.replace(/\!\[([^]*?)\]\(([^)]*?)\)/g, '')
.replace(/\[([^]*?)\]\(([^)]*?)\)/g, '$1')
.replace(ESCAPE_REG, '$1') // 处理转义字符
diff --git a/src/markd/index.wc b/src/markd/index.wc
index 1e76e0b..a70add4 100644
--- a/src/markd/index.wc
+++ b/src/markd/index.wc
@@ -23,7 +23,10 @@ em,
del {
color: nth($cgr, 2);
}
-strong {
+strong,
+strong em,
+strong,
+del {
color: nth($cd, 3);
}
a {