markdown2typst 0.1.1 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +39 -8
- package/dist/markdown2typst.js +2 -0
- package/dist/markdown2typst.js.map +2 -2
- package/dist/markdown2typst.min.js +6 -6
- package/package.json +1 -1
- package/src/markdown2typst.ts +3 -0
package/README.md
CHANGED
|
@@ -100,7 +100,7 @@ Note: any non-standard key is simply ignored, all keys are optional. The front-m
|
|
|
100
100
|
### NPM package (for Node.js projects)
|
|
101
101
|
Package link:
|
|
102
102
|
|
|
103
|
-
[](https://www.npmjs.com/package/markdown2typst)
|
|
103
|
+
[https://www.npmjs.com/package/markdown2typst](https://www.npmjs.com/package/markdown2typst)
|
|
104
104
|
|
|
105
105
|
Install it:
|
|
106
106
|
|
|
@@ -141,26 +141,46 @@ A javascript bundle will appear in the `dist` folder. Make the desired changes t
|
|
|
141
141
|
npm run test
|
|
142
142
|
```
|
|
143
143
|
|
|
144
|
+
## Simple Usage
|
|
144
145
|
|
|
145
|
-
|
|
146
|
+
#### Using the package
|
|
146
147
|
|
|
147
|
-
|
|
148
|
+
##### Simplest example
|
|
149
|
+
```javascript
|
|
150
|
+
import { markdown2typst } from 'markdown2typst';
|
|
151
|
+
|
|
152
|
+
const markdown = '# Hello Typst\n\nThis is a **test**.';
|
|
153
|
+
const typst = markdown2typst(markdown);
|
|
154
|
+
console.log(typst);
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
##### Converting a Markdown file
|
|
158
|
+
```js
|
|
159
|
+
import { markdown2typst } from 'markdown2typst';
|
|
160
|
+
import { readFileSync } from 'fs';
|
|
161
|
+
|
|
162
|
+
const markdown = readFileSync('./example-file.md', 'utf-8');
|
|
163
|
+
const typst = markdown2typst(markdown);
|
|
164
|
+
console.log(typst);
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
#### Using the bundle - Locally
|
|
148
168
|
|
|
149
|
-
|
|
169
|
+
Suppose you've downloaded the JS bundle and saved it in a `assets` folder, now for using it in your website you would simply do:
|
|
150
170
|
|
|
151
|
-
##### In Node.js (ESM)
|
|
171
|
+
##### In Node.js (ESM)
|
|
152
172
|
```javascript
|
|
153
|
-
import { markdown2typst } from './
|
|
173
|
+
import { markdown2typst } from './assets/markdown2typst.min.js';
|
|
154
174
|
|
|
155
175
|
const markdown = '# Hello Typst\n\nThis is a **test**.';
|
|
156
176
|
const typst = markdown2typst(markdown);
|
|
157
177
|
console.log(typst);
|
|
158
178
|
```
|
|
159
179
|
|
|
160
|
-
##### In the browser
|
|
180
|
+
##### In the browser
|
|
161
181
|
```html
|
|
162
182
|
<script type="module">
|
|
163
|
-
import { markdown2typst } from './
|
|
183
|
+
import { markdown2typst } from './assets/markdown2typst.min.js';
|
|
164
184
|
|
|
165
185
|
const markdown = '# Hello Typst';
|
|
166
186
|
const typst = markdown2typst(markdown);
|
|
@@ -168,6 +188,17 @@ console.log(typst);
|
|
|
168
188
|
</script>
|
|
169
189
|
```
|
|
170
190
|
|
|
191
|
+
#### Using the bundle - Via CDN
|
|
192
|
+
|
|
193
|
+
```html
|
|
194
|
+
<script src="https://cdn.jsdelivr.net/npm/markdown2typst@latest/dist/markdown2typst.min.js"></script>
|
|
195
|
+
<script>
|
|
196
|
+
const markdown = '# Hello Typst\n\nThis is a **test**.';
|
|
197
|
+
const typst = markdown2typst(markdown);
|
|
198
|
+
console.log(typst);
|
|
199
|
+
</script>
|
|
200
|
+
```
|
|
201
|
+
|
|
171
202
|
## Examples
|
|
172
203
|
|
|
173
204
|
See the [Examples](/examples/README.md) page for basic and advanced examples on how to use the library and all the features it supports.
|
package/dist/markdown2typst.js
CHANGED
|
@@ -20455,8 +20455,10 @@ function markdown2typst(markdown, options = {}) {
|
|
|
20455
20455
|
throw error;
|
|
20456
20456
|
}
|
|
20457
20457
|
}
|
|
20458
|
+
var markdown2typst_default = markdown2typst;
|
|
20458
20459
|
export {
|
|
20459
20460
|
ErrorSeverity,
|
|
20461
|
+
markdown2typst_default as default,
|
|
20460
20462
|
markdown2typst
|
|
20461
20463
|
};
|
|
20462
20464
|
/**
|