Skip to content

Commit

Permalink
Merge branch 'bugfix/3' of https://github.com/twouters/slack-markdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Sorunome committed Jan 21, 2021
2 parents 2fbac77 + 159c463 commit 7375c30
Show file tree
Hide file tree
Showing 5 changed files with 170 additions and 186 deletions.
18 changes: 15 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const rules = {
},
}),
codeBlock: Object.assign({}, markdown.defaultRules.codeBlock, {
match: markdown.inlineRegex(/^```([^]+?)\n*```/i),
match: markdown.inlineRegex(/^```([^]+?`*)\n*```/i),
parse: (capture, parse, state) => {
return {
content: capture[1] || "",
Expand All @@ -102,7 +102,6 @@ const rules = {
},
}),
newline: markdown.defaultRules.newline,
escape: markdown.defaultRules.escape,
autolink: Object.assign({}, markdown.defaultRules.autolink, {
order: markdown.defaultRules.strong.order + 1,
match: markdown.inlineRegex(/^<((?:https?:\/\/|mailto:)[^|>]+)(\|([^>]*))?>/),
Expand Down Expand Up @@ -134,8 +133,21 @@ const rules = {
return htmlTag("a", output(node.content, state), { href: markdown.sanitizeUrl(node.target) }, state);
},
}),
noem: {
order: markdown.defaultRules.text.order,
match: (source) => /^\\_/.exec(source),
parse: function(capture) {
return {
type: "text",
content: "\\_",
};
},
html: function(node, output, state) {
return output(node.content, state);
},
},
em: Object.assign({}, markdown.defaultRules.em, {
match: markdown.inlineRegex(/^\b_(\S(?:\\[\s\S]|[^\\])*?\S|\S)_(?!_)/),
match: markdown.inlineRegex(/^\b_(\S(?:\\[\s\S]|[^\\])*?\S|\S)_(?!_)\b/),
parse: (capture, parse) => {
return {
content: parse(capture[1]),
Expand Down
Loading

0 comments on commit 7375c30

Please sign in to comment.