markdown-cache 1.0.0 → 1.0.1

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 +40 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1 +1,41 @@
1
1
  # md-cache
2
+
3
+ ## Introduction
4
+
5
+ It is a light weight way to get your markdown files by only rendering it when it changes.
6
+
7
+ Spawn `.cache` dir in your root dir.
8
+
9
+ Support frontmatter.
10
+
11
+ ## Install
12
+
13
+ ```bash
14
+ npm i markdown-cache
15
+ ```
16
+
17
+ ## Use
18
+
19
+ Use `express` server for example.
20
+
21
+ ```js
22
+ import express from "express";
23
+ import MarkdownCache from "markdown-cache";
24
+ import markdownIt from "markdown-it";
25
+
26
+ const app = express();
27
+
28
+ const md = new markdownIt();
29
+
30
+ const mdCacheEngine = new MarkdownCache({
31
+ md: md, // markdown-it, error if not get it
32
+ root: "./", // working root dir, default to process.cwd()
33
+ mdRoot: "markdown" // dir to your md files, default to "markdown"
34
+ });
35
+
36
+ app.use(/\.md$/, (req, res, next) => {
37
+ res.send(await mdCacheEngine.html(req.path));
38
+ });
39
+
40
+ app.listen(8080);
41
+ ```
package/package.json CHANGED
@@ -9,7 +9,7 @@
9
9
  "express"
10
10
  ],
11
11
  "license": "MIT",
12
- "version": "1.0.0",
12
+ "version": "1.0.1",
13
13
  "repository": {
14
14
  "type": "git",
15
15
  "url": "git://github.com/xyxjs/md-cache.git"