Skip to content

Commit

Permalink
feat(message-parser): Parser options (#739)
Browse files Browse the repository at this point in the history
  • Loading branch information
tassoevan authored Jun 15, 2022
1 parent 875702a commit fbaee98
Show file tree
Hide file tree
Showing 18 changed files with 610 additions and 333 deletions.
2 changes: 1 addition & 1 deletion packages/fuselage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
"autoprefixer": "~10.4.2",
"babel-loader": "~8.2.3",
"bump": "workspace:~",
"caniuse-lite": "~1.0.30001311",
"caniuse-lite": "~1.0.30001351",
"copy-webpack-plugin": "~10.2.4",
"cross-env": "^7.0.3",
"css-loader": "~6.6.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/message-parser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
"lint-all": "workspace:~",
"lint-staged": "~12.3.3",
"npm-run-all": "^4.1.5",
"peggy": "^1.2.0",
"peggy": "^2.0.1",
"prettier": "~2.5.1",
"prettier-plugin-pegjs": "~0.5.0",
"rimraf": "^3.0.2",
Expand Down
33 changes: 26 additions & 7 deletions packages/message-parser/src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,17 @@ export type BigEmoji = {
value: [Emoji] | [Emoji, Emoji] | [Emoji, Emoji, Emoji];
};

export type Emoji = {
type: 'EMOJI';
value: Plain;
};
export type Emoji =
| {
type: 'EMOJI';
value: Plain;
shortCode: string;
}
| {
type: 'EMOJI';
value: undefined;
unicode: string;
};

export type Code = {
type: 'CODE';
Expand Down Expand Up @@ -101,6 +108,16 @@ export type Plain = {

export type LineBreak = {
type: 'LINE_BREAK';
value: undefined;
};

export type KaTeX = {
type: 'KATEX';
value: string;
};

export type InlineKaTeX = {
type: 'INLINE_KATEX';
value: string;
};

Expand Down Expand Up @@ -193,7 +210,8 @@ export type Inlines =
| UserMention
| ChannelMention
| Emoji
| Color;
| Color
| InlineKaTeX;

export type Blocks =
| Code
Expand All @@ -203,6 +221,7 @@ export type Blocks =
| Tasks
| OrderedList
| UnorderedList
| LineBreak;
| LineBreak
| KaTeX;

export type MarkdownAST = Array<Paragraph | Blocks> | [BigEmoji];
export type Root = Array<Paragraph | Blocks> | [BigEmoji];
Loading

0 comments on commit fbaee98

Please sign in to comment.