@lowlighter/markdown 1.0.0

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 (50) hide show
  1. package/README.md +29 -0
  2. package/deno.jsonc +119 -0
  3. package/deno.lock +2777 -0
  4. package/mod.mjs +1 -0
  5. package/mod.ts +2 -0
  6. package/mod_test.ts +1 -0
  7. package/package.json +42 -0
  8. package/plugins/anchors.mjs +1 -0
  9. package/plugins/anchors.ts +21 -0
  10. package/plugins/anchors_test.ts +8 -0
  11. package/plugins/directives.mjs +1 -0
  12. package/plugins/directives.ts +112 -0
  13. package/plugins/directives_test.ts +13 -0
  14. package/plugins/emojis.mjs +1 -0
  15. package/plugins/emojis.ts +20 -0
  16. package/plugins/emojis_test.ts +8 -0
  17. package/plugins/frontmatter.mjs +1 -0
  18. package/plugins/frontmatter.ts +43 -0
  19. package/plugins/frontmatter_test.ts +18 -0
  20. package/plugins/gfm.mjs +1 -0
  21. package/plugins/gfm.ts +14 -0
  22. package/plugins/gfm_test.ts +28 -0
  23. package/plugins/highlighting.mjs +1 -0
  24. package/plugins/highlighting.ts +24 -0
  25. package/plugins/highlighting_test.ts +8 -0
  26. package/plugins/linebreaks.mjs +1 -0
  27. package/plugins/linebreaks.ts +21 -0
  28. package/plugins/linebreaks_test.ts +8 -0
  29. package/plugins/markers.mjs +1 -0
  30. package/plugins/markers.ts +25 -0
  31. package/plugins/markers_test.ts +13 -0
  32. package/plugins/math.ts +25 -0
  33. package/plugins/math_test.ts +8 -0
  34. package/plugins/mermaid.ts +41 -0
  35. package/plugins/mermaid_test.ts +8 -0
  36. package/plugins/ruby.mjs +1 -0
  37. package/plugins/ruby.ts +20 -0
  38. package/plugins/ruby_test.ts +8 -0
  39. package/plugins/sanitize.mjs +1 -0
  40. package/plugins/sanitize.ts +26 -0
  41. package/plugins/sanitize_test.ts +15 -0
  42. package/plugins/uncomments.mjs +1 -0
  43. package/plugins/uncomments.ts +20 -0
  44. package/plugins/uncomments_test.ts +8 -0
  45. package/plugins/wikilinks.mjs +1 -0
  46. package/plugins/wikilinks.ts +40 -0
  47. package/plugins/wikilinks_test.ts +14 -0
  48. package/renderer.mjs +1 -0
  49. package/renderer.ts +124 -0
  50. package/renderer_test.ts +14 -0
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # 🖨️ Markdown
2
+
3
+ [![JSR](https://jsr.io/badges/@libs/markdown)](https://jsr.io/@libs/markdown) [![JSR Score](https://jsr.io/badges/@libs/markdown/score)](https://jsr.io/@libs/markdown)
4
+ [![NPM](https://img.shields.io/npm/v/@lowlighter%2Fmarkdown?logo=npm&labelColor=cb0000&color=183e4e)](https://www.npmjs.com/package/@lowlighter/markdown) [![Coverage](https://libs-coverage.lecoq.io/markdown/badge.svg)](https://libs-coverage.lecoq.io/markdown)
5
+
6
+ - [`🦕 Playground`](https://libs.lecoq.io/markdown)
7
+ - [`📚 Documentation`](https://jsr.io/@libs/markdown/doc)
8
+
9
+ ## ✨ Features
10
+
11
+ - Render markdown to HTML using the [unified ecosystem](https://unifiedjs.com).
12
+ - Straightforward API for both basic markdown and extended markdown rendering
13
+ - Support out-of-the-box dozen of plugins to add extended markdown features
14
+ - Headings anchors
15
+ - Frontmatter
16
+ - Code highlighting
17
+ - Math
18
+ - Mermaid diagrams
19
+ - Wiki links
20
+ - etc.
21
+
22
+ ## 📜 Licenses and credits
23
+
24
+ ```plaintext
25
+ Copyright (c) Simon Lecoq <@lowlighter>. (MIT License)
26
+ https://github.com/lowlighter/libs/blob/main/LICENSE
27
+ ```
28
+
29
+ This library rely on the awesome [unified ecosystem](https://unifiedjs.com).
package/deno.jsonc ADDED
@@ -0,0 +1,119 @@
1
+ {
2
+ "icon": "🖨️",
3
+ "name": "@libs/markdown",
4
+ "version": "1.0.0",
5
+ "description": "Markdown renderer with optional plugins based on the unified ecosystem.",
6
+ "keywords": [
7
+ "markdown",
8
+ "plugins",
9
+ "gfm",
10
+ "github-flavored-markdown",
11
+ "unified",
12
+ "remark",
13
+ "rehype"
14
+ ],
15
+ "license": "MIT",
16
+ "author": "lowlighter (Simon Lecoq)",
17
+ "funding": "https://github.com/sponsors/lowlighter",
18
+ "homepage": "https://github.com/lowlighter/libs",
19
+ "playground": "https://libs.lecoq.io/markdown",
20
+ "supported": [
21
+ "deno"
22
+ ],
23
+ "repository": {
24
+ "type": "git",
25
+ "url": "git+https://github.com/lowlighter/libs.git"
26
+ },
27
+ "npm": true,
28
+ "exports": {
29
+ ".": "./mod.ts",
30
+ "./renderer": "./renderer.ts",
31
+ "./plugins/anchors": "./plugins/anchors.ts",
32
+ "./plugins/highlighting": "./plugins/highlighting.ts",
33
+ "./plugins/directives": "./plugins/directives.ts",
34
+ "./plugins/emojis": "./plugins/emojis.ts",
35
+ "./plugins/frontmatter": "./plugins/frontmatter.ts",
36
+ "./plugins/gfm": "./plugins/gfm.ts",
37
+ "./plugins/linebreaks": "./plugins/linebreaks.ts",
38
+ "./plugins/markers": "./plugins/markers.ts",
39
+ "./plugins/uncomments": "./plugins/uncomments.ts",
40
+ "./plugins/ruby": "./plugins/ruby.ts",
41
+ "./plugins/sanitize": "./plugins/sanitize.ts",
42
+ "./plugins/wikilinks": "./plugins/wikilinks.ts"
43
+ },
44
+ "imports": {
45
+ "unified": "npm:unified@11",
46
+ "hast": "npm:@types/hast@3",
47
+ "hastscript": "npm:hastscript@9",
48
+ "unist-util-visit": "npm:unist-util-visit@5",
49
+ "rehype-slug": "npm:rehype-slug@6",
50
+ "rehype-autolink-headings": "npm:rehype-autolink-headings@7",
51
+ "rehype-highlight": "npm:rehype-highlight@7",
52
+ "rehype-raw": "npm:rehype-raw@7",
53
+ "rehype-sanitize": "npm:rehype-sanitize@6",
54
+ "rehype-stringify": "npm:rehype-stringify@10",
55
+ "remark-breaks": "npm:remark-breaks@4",
56
+ "remark-flexible-markers": "npm:remark-flexible-markers@1",
57
+ "remark-wiki-link": "npm:remark-wiki-link@2",
58
+ "remark-gfm": "npm:remark-gfm@4",
59
+ "remark-parse": "npm:remark-parse@11",
60
+ "remark-rehype": "npm:remark-rehype@11",
61
+ "remark-directive": "npm:remark-directive@3",
62
+ "remark-ruby": "npm:remark-ruby@0.4.0",
63
+ "remark-frontmatter": "npm:remark-frontmatter@5",
64
+ "remark-emoji": "npm:remark-emoji@5",
65
+ "remark-remove-comments": "npm:remark-remove-comments@1",
66
+ "remark-math": "npm:remark-math@6",
67
+ "rehype-mathjax": "npm:rehype-mathjax@6",
68
+ "rehype-mermaid": "npm:rehype-mermaid@2",
69
+ "@std/text/slugify": "jsr:@std/text@1/slugify",
70
+ "@std/yaml/parse": "jsr:@std/yaml@1/parse",
71
+ "@libs/testing": "jsr:@libs/testing@2",
72
+ "@libs/typing": "jsr:@libs/typing@2"
73
+ },
74
+ "test:permissions": {
75
+ "read": true,
76
+ "env": true,
77
+ "write": true,
78
+ "sys": true,
79
+ "run": true
80
+ },
81
+ "tasks": {
82
+ "build": "npx playwright-core install --with-deps chromium",
83
+ "test": "deno test --allow-read --allow-env --allow-write --allow-sys --allow-run --no-prompt --coverage --clean --trace-leaks --doc",
84
+ "test:deno": "deno fmt --check && deno task test --filter='/^\\[deno\\]/' --quiet && deno coverage --exclude=.js && deno lint",
85
+ "test:deno-future": "DENO_FUTURE=1 && deno task test:deno",
86
+ "test:others": "deno fmt --check && deno task test --filter='/^\\[node|bun \\]/' --quiet && deno coverage --exclude=.js && deno lint",
87
+ "coverage:html": "deno task test --filter='/^\\[deno\\]/' --quiet && deno coverage --exclude=.js --html && sleep 1",
88
+ "dev": "deno fmt && deno task test --filter='/^\\[deno\\]/' && deno coverage --exclude=.js --detailed && deno task lint",
89
+ "lint": "deno fmt --check && deno lint && deno doc --lint mod.ts && deno publish --dry-run --quiet --allow-dirty"
90
+ },
91
+ "lint": {
92
+ "rules": {
93
+ "include": [
94
+ "no-throw-literal",
95
+ "no-eval",
96
+ "eqeqeq",
97
+ "ban-untagged-todo"
98
+ ]
99
+ },
100
+ "exclude": [
101
+ "**/wasm_*",
102
+ "**/*.mjs"
103
+ ]
104
+ },
105
+ "fmt": {
106
+ "lineWidth": 280,
107
+ "semiColons": false,
108
+ "exclude": [
109
+ "coverage",
110
+ "**/coverage",
111
+ "**/node_modules",
112
+ "**/package.json",
113
+ "**/package-lock.json",
114
+ "**/wasm_*",
115
+ "**/*.mjs"
116
+ ],
117
+ "proseWrap": "preserve"
118
+ }
119
+ }