Skip to content

Commit

Permalink
refactor: compile away priority mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
quantizor committed Jan 1, 2024
1 parent 4b5f1c3 commit 79d640b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 25 deletions.
46 changes: 23 additions & 23 deletions index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@ export const RuleType = {
unorderedList: 33,
} as const

const enum Priority {
/**
* anything that must scan the tree before everything else
*/
MAX,
/**
* scans for block-level constructs
*/
HIGH,
/**
* inline w/ more priority than other inline
*/
MED,
/**
* inline elements
*/
LOW,
/**
* bare text and stuff that is considered leftovers
*/
MIN,
}

export namespace MarkdownToJSX {
/**
* RequireAtLeastOne<{ ... }> <- only requires at least one key
Expand Down Expand Up @@ -1220,29 +1243,6 @@ function getTag(tag: string, overrides: MarkdownToJSX.Overrides) {
: get(overrides, `${tag}.component`, tag)
}

enum Priority {
/**
* anything that must scan the tree before everything else
*/
MAX,
/**
* scans for block-level constructs
*/
HIGH,
/**
* inline w/ more priority than other inline
*/
MED,
/**
* inline elements
*/
LOW,
/**
* bare text and stuff that is considered leftovers
*/
MIN,
}

export function compiler(
markdown: string,
options: MarkdownToJSX.Options = {}
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"module": "ESNext",
"moduleResolution": "node",
"outDir": "./dist",
"target": "ESNext",
"preserveConstEnums": true
"preserveConstEnums": true,
"target": "ESNext"
},
"files": ["index.tsx"]
}

0 comments on commit 79d640b

Please sign in to comment.