The communications platform that puts data protection first.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Rocket.Chat/packages/message-parser
Kevin Aleman 085fa5e864
chore: Update typescript to 5.6 (#33665)
1 year ago
..
loaders chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago
src fix: message parser being slow to process very long messages with too many symbols (#33254) 1 year ago
tests fix: message parser being slow to process very long messages with too many symbols (#33254) 1 year ago
.eslintignore chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago
.eslintrc.js chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago
.gitignore chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago
.prettierrc.js chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago
CHANGELOG.md Release 6.13.0 1 year ago
README.md feat(message-parser): add timestamps pattern (#31810) 2 years ago
babel.config.js chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago
jest.config.ts refactor(tests): Align Jest tests (#32550) 1 year ago
messageParser.js chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago
package.json chore: Update typescript to 5.6 (#33665) 1 year ago
tsconfig-bundle.json chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago
tsconfig.json fix: message parser emphasis black hole (#31868) 2 years ago
typedoc.json chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago
webpack.config.js chore: move message-parser and peggy-loader to main repo (#31796) 2 years ago

README.md

Rocket.Chat

@rocket.chat/message-parser

Rocket.Chat parser for messages


npm@latest npm@next npm downloads License: MIT

deps npm bundle size

Description

Rocket.Chat grammar with the purpose of parsing the messages of the rocket chat, converting text to an AST tree.

The grammar provides support for markdown, mentions and emojis.

Supported markup

  • quotes
  • bold/italic/strike
  • ordered lists
  • unordered lists
  • task lists
  • phone numbers
  • mentions
  • emoji
  • colors
  • URI's
  • mentions users/channels
  • timestamps

Timestamps

The timestamp tag is a special tag that allows you to convert a Unix timestamp to a human-readable date and time.

Timestamps are allowed inside strike elements.

Usage

Pattern: <t:{timestamp}:?{format}>

  • {timestamp} is a Unix timestamp
  • {format} is an optional parameter that can be used to customize the date and time format.

Formats

Format Description Example
t Short time 12:00 AM
T Long time 12:00:00 AM
d Short date 12/31/2020
D Long date Thursday, December 31, 2020
f Full date and time Thursday, December 31, 2020 12:00 AM
F Full date and time (long) Thursday, December 31, 2020 12:00:00 AM
R Relative time 1 year ago

Contributing

Contributions, issues, and feature requests are welcome!
Feel free to check the issues.

Whenever you find a grammar-related bug, start by inserting the test case.

We are open to other tags/markups, as long as they don't generate unexpected behavior.

Observations and known issues

  • Nested lists are unsupported
  • URL rule doesn't allow whitespace, (, or )