writr 4.4.1 → 4.4.3

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.
Files changed (2) hide show
  1. package/README.md +49 -22
  2. package/package.json +13 -13
package/README.md CHANGED
@@ -4,13 +4,28 @@
4
4
  [![tests](https://github.com/jaredwray/writr/actions/workflows/tests.yml/badge.svg)](https://github.com/jaredwray/writr/actions/workflows/tests.yml)
5
5
  [![GitHub license](https://img.shields.io/github/license/jaredwray/writr)](https://github.com/jaredwray/writr/blob/master/LICENSE)
6
6
  [![codecov](https://codecov.io/gh/jaredwray/writr/branch/master/graph/badge.svg?token=1YdMesM07X)](https://codecov.io/gh/jaredwray/writr)
7
+ [![jsDelivr](https://data.jsdelivr.com/v1/package/npm/writr/badge)](https://www.jsdelivr.com/package/npm/writr)
7
8
  [![npm](https://img.shields.io/npm/dm/writr)](https://npmjs.com/package/writr)
8
9
  [![npm](https://img.shields.io/npm/v/writr)](https://npmjs.com/package/writr)
9
10
 
11
+ # Features
12
+ * Removes the remark / unified complexity and easy to use.
13
+ * Built in caching 💥 making it render very fast when there isnt a change
14
+ * Frontmatter support built in by default. :tada:
15
+ * Easily Render to `React` or `HTML`.
16
+ * Generates a Table of Contents for your markdown files (remark-toc).
17
+ * Slug generation for your markdown files (rehype-slug).
18
+ * Code Highlighting (rehype-highlight).
19
+ * Math Support (rehype-katex).
20
+ * Markdown to HTML (rehype-stringify).
21
+ * Github Flavor Markdown (remark-gfm).
22
+ * Emoji Support (remark-emoji).
23
+ * MDX Support (remark-mdx).
24
+ * Built in Hooks for adding code to render pipeline.
25
+
10
26
  # Table of Contents
11
- - [Features](#features)
12
- - [ESM and Node Version Support](#esm-and-node-version-support)
13
27
  - [Getting Started](#getting-started)
28
+ - [Running via Browser as an ESM Module](#running-via-browser-as-an-esm-module)
14
29
  - [API](#api)
15
30
  - [`new Writr(arg?: string | WritrOptions, options?: WritrOptions)`](#new-writrarg-string--writroptions-options-writroptions)
16
31
  - [`.content`](#content)
@@ -31,29 +46,10 @@
31
46
  - [`.saveToFile(filePath: string): Promise<void>`](#savetofilefilepath-string-promisevoid)
32
47
  - [`.saveToFileSync(filePath: string): void`](#savetofilesyncfilepath-string-void)
33
48
  - [Hooks](#hooks)
49
+ - [ESM and Node Version Support](#esm-and-node-version-support)
34
50
  - [Code of Conduct and Contributing](#code-of-conduct-and-contributing)
35
51
  - [License](#license)
36
52
 
37
-
38
- # Features
39
- * Removes the remark / unified complexity and easy to use.
40
- * Built in caching 💥 making it render very fast when there isnt a change
41
- * Frontmatter support built in by default. :tada:
42
- * Easily Render to `React` or `HTML`.
43
- * Generates a Table of Contents for your markdown files (remark-toc).
44
- * Slug generation for your markdown files (rehype-slug).
45
- * Code Highlighting (rehype-highlight).
46
- * Math Support (rehype-katex).
47
- * Markdown to HTML (rehype-stringify).
48
- * Github Flavor Markdown (remark-gfm).
49
- * Emoji Support (remark-emoji).
50
- * MDX Support (remark-mdx).
51
- * Built in Hooks for adding code to render pipeline.
52
-
53
- # ESM and Node Version Support
54
-
55
- This package is ESM only and tested on the current lts version and its previous. Please don't open issues for questions regarding CommonJS / ESM or previous Nodejs versions. To learn more about using ESM please read this from `sindresorhus`: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
56
-
57
53
  # Getting Started
58
54
 
59
55
  ```bash
@@ -101,6 +97,33 @@ const writr = new Writr(`# Hello World ::-):\n\n This is a test.`, writrOptions)
101
97
  const html = await writr.render(options); // <h1>Hello World ::-):</h1><p>This is a test.</p>
102
98
  ```
103
99
 
100
+ # Running via Browser as an ESM Module
101
+
102
+ You can also run Writr via the browser. Here is an example of how to do that.
103
+
104
+ ```html
105
+ <!DOCTYPE html>
106
+ <html lang="en">
107
+ <head>
108
+ <meta charset="UTF-8">
109
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
110
+ <title>Writr Example</title>
111
+ <script type="module">
112
+ import {Writr} from 'https://cdn.jsdelivr.net/npm/writr@latest/+esm'
113
+
114
+ const writr = new Writr(`# Hello World ::-):\n\n This is a test.`);
115
+ writr.render().then(html => {
116
+ document.body.innerHTML = html;
117
+ });
118
+ </script>
119
+ </head>
120
+ <body>
121
+ </body>
122
+ </html>
123
+ ```
124
+
125
+ This will render the markdown to HTML and display it in the body of the page.
126
+
104
127
  # API
105
128
 
106
129
  ## `new Writr(arg?: string | WritrOptions, options?: WritrOptions)`
@@ -412,6 +435,10 @@ export type loadFromFileData = {
412
435
 
413
436
  This is called when you call `loadFromFile`, `loadFromFileSync`.
414
437
 
438
+ # ESM and Node Version Support
439
+
440
+ This package is ESM only and tested on the current lts version and its previous. Please don't open issues for questions regarding CommonJS / ESM or previous Nodejs versions. To learn more about using ESM please read this from `sindresorhus`: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
441
+
415
442
  # Code of Conduct and Contributing
416
443
  [Code of Conduct](CODE_OF_CONDUCT.md) and [Contributing](CONTRIBUTING.md) guidelines.
417
444
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "writr",
3
- "version": "4.4.1",
3
+ "version": "4.4.3",
4
4
  "description": "Markdown Rendering Simplified",
5
5
  "type": "module",
6
6
  "main": "./dist/writr.js",
@@ -53,11 +53,11 @@
53
53
  "website:serve": "rimraf ./site/README.md ./site/dist && npx docula serve -s ./site -o ./site/dist"
54
54
  },
55
55
  "dependencies": {
56
- "cacheable": "^1.8.8",
57
- "hookified": "^1.7.1",
58
- "html-react-parser": "^5.2.2",
56
+ "cacheable": "^1.8.10",
57
+ "hookified": "^1.8.2",
58
+ "html-react-parser": "^5.2.3",
59
59
  "js-yaml": "^4.1.0",
60
- "react": "^19.0.0",
60
+ "react": "^19.1.0",
61
61
  "rehype-highlight": "^7.0.2",
62
62
  "rehype-katex": "^7.0.1",
63
63
  "rehype-slug": "^6.0.0",
@@ -67,22 +67,22 @@
67
67
  "remark-math": "^6.0.0",
68
68
  "remark-mdx": "^3.1.0",
69
69
  "remark-parse": "^11.0.0",
70
- "remark-rehype": "^11.1.1",
70
+ "remark-rehype": "^11.1.2",
71
71
  "remark-toc": "^9.0.0",
72
72
  "unified": "^11.0.5"
73
73
  },
74
74
  "devDependencies": {
75
75
  "@types/js-yaml": "^4.0.9",
76
- "@types/node": "^22.13.5",
77
- "@types/react": "^19.0.10",
78
- "@vitest/coverage-v8": "^3.0.7",
79
- "docula": "^0.10.1",
76
+ "@types/node": "^22.15.3",
77
+ "@types/react": "^19.1.2",
78
+ "@vitest/coverage-v8": "^3.1.2",
79
+ "docula": "^0.11.1",
80
80
  "rimraf": "^6.0.1",
81
81
  "ts-node": "^10.9.2",
82
82
  "tsup": "^8.4.0",
83
- "typescript": "^5.7.3",
84
- "vitest": "^3.0.7",
85
- "webpack": "^5.98.0",
83
+ "typescript": "^5.8.3",
84
+ "vitest": "^3.1.2",
85
+ "webpack": "^5.99.7",
86
86
  "xo": "^0.60.0"
87
87
  },
88
88
  "xo": {