Top 7.0% dependent packages on proxy.golang.org
proxy.golang.org : github.com/delthas/discord-formatting
Package formatting is a small Go library for parsing Discord markdown-like messages to an AST. The goal is to copy the Discord apps behavior as precisely as possible. This is not a general purpose Markdown parser. The main entrypoint to the library is the Parser type, along with its NewParser function. A Parser is used to Parser.Parse a Discord message string into an AST represented by a Node. A Node is a node of the message tree and has a list of Node children. There are several types implementing the Node interface, such as TextNode. The recommended way to consume the AST is to Walk it, with a Walker function that runs a type switch on the Node type, to display appropriate begin/end formatting, or set internal state. It is recommended that unknown Node types be ignored by the consumer. For example, when writing a Discord to IRC bridge, the function passed to Walk would output an IRC bold formatting character to the output on entering and leaving a BoldNode. The library currently does not come with official formatters for the message AST. The Debug function can be used to print a node tree in a human-readable format.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/delthas/discord-formatting
Keywords:
ast
, discord
, formatting
, markdown
, parser
License: MIT
Latest release: almost 3 years ago
First release: almost 3 years ago
Namespace: github.com/delthas
Dependent packages: 1
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: 20 days ago