Skip to content

Commit 79d640b

Browse files
committed
refactor: compile away priority mapping
1 parent 4b5f1c3 commit 79d640b

File tree

2 files changed

+25
-25
lines changed

2 files changed

+25
-25
lines changed

index.tsx

+23-23
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,29 @@ export const RuleType = {
5454
unorderedList: 33,
5555
} as const
5656

57+
const enum Priority {
58+
/**
59+
* anything that must scan the tree before everything else
60+
*/
61+
MAX,
62+
/**
63+
* scans for block-level constructs
64+
*/
65+
HIGH,
66+
/**
67+
* inline w/ more priority than other inline
68+
*/
69+
MED,
70+
/**
71+
* inline elements
72+
*/
73+
LOW,
74+
/**
75+
* bare text and stuff that is considered leftovers
76+
*/
77+
MIN,
78+
}
79+
5780
export namespace MarkdownToJSX {
5881
/**
5982
* RequireAtLeastOne<{ ... }> <- only requires at least one key
@@ -1220,29 +1243,6 @@ function getTag(tag: string, overrides: MarkdownToJSX.Overrides) {
12201243
: get(overrides, `${tag}.component`, tag)
12211244
}
12221245

1223-
enum Priority {
1224-
/**
1225-
* anything that must scan the tree before everything else
1226-
*/
1227-
MAX,
1228-
/**
1229-
* scans for block-level constructs
1230-
*/
1231-
HIGH,
1232-
/**
1233-
* inline w/ more priority than other inline
1234-
*/
1235-
MED,
1236-
/**
1237-
* inline elements
1238-
*/
1239-
LOW,
1240-
/**
1241-
* bare text and stuff that is considered leftovers
1242-
*/
1243-
MIN,
1244-
}
1245-
12461246
export function compiler(
12471247
markdown: string,
12481248
options: MarkdownToJSX.Options = {}

tsconfig.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
"module": "ESNext",
99
"moduleResolution": "node",
1010
"outDir": "./dist",
11-
"target": "ESNext",
12-
"preserveConstEnums": true
11+
"preserveConstEnums": true,
12+
"target": "ESNext"
1313
},
1414
"files": ["index.tsx"]
1515
}

0 commit comments

Comments
 (0)