Rocket.Chat/packages/message-parser
Guilherme Gazzo b2d864c568
Some checks are pending
Deploy GitHub Pages / deploy-preview (push) Waiting to run
CI / ⚙️ Variables Setup (push) Waiting to run
CI / 🚀 Notify external services - draft (push) Blocked by required conditions
CI / 📦 Build Packages (push) Blocked by required conditions
CI / deploy-preview (push) Blocked by required conditions
CI / 📦 Meteor Build - coverage (push) Blocked by required conditions
CI / 📦 Meteor Build - official (push) Blocked by required conditions
CI / Builds matrix rust bindings against alpine (push) Waiting to run
CI / 🚢 Build Docker Images for Testing (alpine) (push) Blocked by required conditions
CI / 🚢 Build Docker Images for Production (alpine) (push) Blocked by required conditions
CI / 🔎 Code Check (push) Blocked by required conditions
CI / 🔨 Test Unit (push) Blocked by required conditions
CI / 🔨 Test API (CE) (push) Blocked by required conditions
CI / 🔨 Test UI (CE) (push) Blocked by required conditions
CI / 🔨 Test API (EE) (push) Blocked by required conditions
CI / 🔨 Test UI (EE) (push) Blocked by required conditions
CI / ✅ Tests Done (push) Blocked by required conditions
CI / 🚀 Publish build assets (push) Blocked by required conditions
CI / 🚀 Publish Docker Image (main) (alpine) (push) Blocked by required conditions
CI / 🚀 Publish Docker Image (services) (account) (push) Blocked by required conditions
CI / 🚀 Publish Docker Image (services) (authorization) (push) Blocked by required conditions
CI / 🚀 Publish Docker Image (services) (ddp-streamer) (push) Blocked by required conditions
CI / 🚀 Publish Docker Image (services) (omnichannel-transcript) (push) Blocked by required conditions
CI / 🚀 Publish Docker Image (services) (presence) (push) Blocked by required conditions
CI / 🚀 Publish Docker Image (services) (queue-worker) (push) Blocked by required conditions
CI / 🚀 Publish Docker Image (services) (stream-hub) (push) Blocked by required conditions
CI / 🚀 Notify external services (push) Blocked by required conditions
CI / trigger-dependent-workflows (push) Blocked by required conditions
CI / Update Version Durability (push) Blocked by required conditions
Code scanning - action / CodeQL-Build (push) Waiting to run
chore: update eslint plugins (#33879)
2024-11-14 10:02:42 -05:00
..
loaders
src chore: minor deps (#33795) 2024-10-29 12:28:49 -04:00
tests chore: minor deps (#33795) 2024-10-29 12:28:49 -04:00
.eslintignore
.eslintrc.js
.gitignore
.prettierrc.js
babel.config.js
CHANGELOG.md Release 6.13.0 2024-10-10 03:10:58 +00:00
jest.config.ts refactor(tests): Align Jest tests (#32550) 2024-08-11 19:38:29 -04:00
messageParser.js
package.json chore: update eslint plugins (#33879) 2024-11-14 10:02:42 -05:00
README.md feat(message-parser): add timestamps pattern (#31810) 2024-03-08 23:51:43 +00:00
tsconfig-bundle.json
tsconfig.json fix: message parser emphasis black hole (#31868) 2024-03-01 21:15:51 +00:00
typedoc.json
webpack.config.js

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 )