slack-message-parser
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -84,3 +84,3 @@ "use strict"; | ||
})); | ||
const parseEmoji = combinator_1.explicit(combinator_1.regexp(/^:([^:]+?)(::([^:]+?))?:(?=\s|$)/, (match, text, position) => { | ||
const parseEmoji = combinator_1.regexp(/^:([^:<]+?)(::([^:]+?))?:/, (match, text, position) => { | ||
const [matchedText, name, _, variation] = match; | ||
@@ -95,3 +95,3 @@ return [ | ||
]; | ||
})); | ||
}); | ||
const parseLink = combinator_1.regexp(/^<([^\s*~_<>]+?)(\|([^<>]+?))?>/, (match, text, position, parseText) => { | ||
@@ -98,0 +98,0 @@ const [matchedText, link, _, label] = match; |
{ | ||
"name": "slack-message-parser", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "Parser for Slack message", | ||
@@ -50,2 +50,6 @@ "main": "lib/index.js", | ||
], | ||
"coverageReporters": [ | ||
"lcov", | ||
"text" | ||
], | ||
"transform": { | ||
@@ -72,2 +76,2 @@ "^.+\\.ts?$": "ts-jest" | ||
} | ||
} | ||
} |
# slack-message-parser | ||
[![npm](https://flat.badgen.net/npm/v/slack-message-parser?icon=npm)](https://www.npmjs.com/package/slack-message-parser) | ||
[![code style: prettier](https://flat.badgen.net/badge/code%20style/prettier/ff69b4)](https://github.com/prettier/prettier) | ||
[![travis](https://flat.badgen.net/travis/pocka/slack-message-parser?icon=travis)](https://travis-ci.com/pocka/slack-message-parser#) | ||
[![codecov](https://flat.badgen.net/codecov/c/github/pocka/slack-message-parser?icon=codecov)](https://codecov.io/gh/pocka/slack-message-parser) | ||
Parser library for [Slack message format](https://api.slack.com/docs/message-formatting). | ||
@@ -23,14 +28,14 @@ | ||
// { | ||
// "type": NodeType.Root, | ||
// "children": [ | ||
// type: NodeType.Root, | ||
// children: [ | ||
// { | ||
// "type": NodeType.Text, | ||
// "text": "Slack " | ||
// type: NodeType.Text, | ||
// text: "Slack " | ||
// }, | ||
// { | ||
// "type": NodeType.Bold, | ||
// "children": [ | ||
// type: NodeType.Bold, | ||
// children: [ | ||
// { | ||
// "type": NodeType.Text, | ||
// "text": "message" | ||
// type: NodeType.Text, | ||
// text: "message" | ||
// } | ||
@@ -49,3 +54,3 @@ // ] | ||
case NodeType.Text: | ||
return `<span>${node.text}</span>` | ||
return node.text | ||
case NodeType.Bold: | ||
@@ -65,3 +70,3 @@ return `<strong>${node.children.map(toHTML).join('')}</strong>` | ||
// Output: | ||
// '<p><span>Slack </span><strong><span>message</span></strong><span> </span><del><span>to</span></del><span> </span><i><span>parse</span></i></p>' | ||
// '<p>Slack <strong>message</strong> <del>to</del> <i>parse</i></p>' | ||
``` |
@@ -122,4 +122,5 @@ import { NodeType } from './types/Node' | ||
const parseEmoji = explicit( | ||
regexp(/^:([^:]+?)(::([^:]+?))?:(?=\s|$)/, (match, text, position) => { | ||
const parseEmoji = regexp( | ||
/^:([^:<]+?)(::([^:]+?))?:/, | ||
(match, text, position) => { | ||
const [matchedText, name, _, variation] = match | ||
@@ -135,3 +136,3 @@ | ||
] | ||
}) | ||
} | ||
) | ||
@@ -138,0 +139,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
151464
27
707
70