File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,6 +24,8 @@ npm i wikistxr
2424
2525## Usage
2626
27+ Await ` ready ` before constructing classes.
28+
2729### WikitextHighlighter
2830
2931** Static, full-pass syntax highlighting**
@@ -32,7 +34,9 @@ npm i wikistxr
3234- Renders to HTML strings.
3335
3436``` javascript
35- import { WikitextHighlighter } from " wikistxr" ;
37+ import { ready , WikitextHighlighter } from " wikistxr" ;
38+
39+ await ready;
3640
3741const highlighter = new WikitextHighlighter ();
3842const html = highlighter .highlight (wikitextString);
@@ -46,7 +50,9 @@ const html = highlighter.highlight(wikitextString);
4650- Handles cursor persistence and DOM synchronization.
4751
4852``` javascript
49- import { WikitextEditor } from " wikistxr" ;
53+ import { ready , WikitextEditor } from " wikistxr" ;
54+
55+ await ready;
5056
5157const editor = new WikitextEditor ();
5258editor .attach (editableDiv);
Original file line number Diff line number Diff line change 11{
22 "name" : " wikistxr" ,
3- "version" : " 0.1.4 " ,
3+ "version" : " 0.1.5 " ,
44 "description" : " Lightweight wikitext library for syntax highlighting and editing." ,
55 "type" : " module" ,
66 "main" : " ./dist/index.js" ,
Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ import {
1212 DEFAULT_STYLES ,
1313} from "./constants" ;
1414
15+ export declare const ready : Promise < void > ;
16+
1517export {
1618 WikitextHighlighter ,
1719 WikitextEditor ,
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { resolve } from "path";
33import topLevelAwait from "vite-plugin-top-level-await" ;
44
55export default defineConfig ( {
6- plugins : [ topLevelAwait ( ) ] ,
6+ plugins : [ topLevelAwait ( { promiseExportName : "ready" } ) ] ,
77 build : {
88 lib : {
99 entry : resolve ( __dirname , "src/lib/index.ts" ) ,
You can’t perform that action at this time.
0 commit comments