Skip to content

Commit

Permalink
feat(markdown): add package (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
lowlighter committed Sep 1, 2024
1 parent a0945fb commit 9bc0375
Show file tree
Hide file tree
Showing 38 changed files with 3,725 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .github/deno_readme.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,17 @@
</li>
<li>Automatically reads <code>LOG_LEVEL</code> environment variable (if available)</li>
</ul>
<ul data-for="markdown">
<li>
Render markdown to HTML using the <a href="https://unifiedjs.com">unified ecosystem</a>.
<ul>
<li>Straightforward API for both basic markdown and extended markdown rendering</li>
<li>
Offer a dozen of plugins to add extended markdown features (headings anchors, frontmatter, code highlighting, math, mermaid diagrams, wiki links, etc.)
</li>
</ul>
</li>
</ul>
<ul data-for="orm">
<li>Manage resources using an agnostic storage inteface</li>
</ul>
Expand Down
15 changes: 15 additions & 0 deletions .playgrounds/markdown/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://matcha.mizu.sh/matcha.css">
<link rel="stylesheet" href="/styles.css">
</head>
<body class="layout-simple">
<main>
<p class="flash danger">
No playground available yet.
</p>
</main>
</body>
</html>
6 changes: 3 additions & 3 deletions deno.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@
"make:config": "deno run --allow-env=LOG_LEVEL,UPGRADE_PACKAGES --allow-read=. --allow-write=. .github/deno_config.ts",
"make:config-upgrade": "UPGRADE_PACKAGES=true deno task make:config",
"tag": "deno run --allow-read --allow-write=. .github/deno_tag.ts",
"test": "cd bundle && deno task test:deno && cd .. && cd crypto && deno task test:deno && cd .. && cd diff && deno task test:deno && cd .. && cd dom && deno task test:deno && cd .. && cd logger && deno task test:deno && cd .. && cd orm && deno task test:deno && cd .. && cd qrcode && deno task test:deno && cd .. && cd reactive && deno task test:deno && cd .. && cd run && deno task test:deno && cd .. && cd std && deno task test:deno && cd .. && cd testing && deno task test:deno && cd .. && cd typing && deno task test:deno && cd .. && cd xml && deno task test:deno && cd ..",
"lint": "cd bundle && deno task lint && cd .. && cd crypto && deno task lint && cd .. && cd diff && deno task lint && cd .. && cd dom && deno task lint && cd .. && cd logger && deno task lint && cd .. && cd orm && deno task lint && cd .. && cd qrcode && deno task lint && cd .. && cd reactive && deno task lint && cd .. && cd run && deno task lint && cd .. && cd std && deno task lint && cd .. && cd testing && deno task lint && cd .. && cd typing && deno task lint && cd .. && cd xml && deno task lint && cd ..",
"coverage": "rm -rf coverage && mkdir -p coverage && cd bundle && deno task coverage:html && mv coverage/html ../coverage/bundle && cd .. && cd crypto && deno task coverage:html && mv coverage/html ../coverage/crypto && cd .. && cd diff && deno task coverage:html && mv coverage/html ../coverage/diff && cd .. && cd dom && deno task coverage:html && mv coverage/html ../coverage/dom && cd .. && cd logger && deno task coverage:html && mv coverage/html ../coverage/logger && cd .. && cd orm && deno task coverage:html && mv coverage/html ../coverage/orm && cd .. && cd qrcode && deno task coverage:html && mv coverage/html ../coverage/qrcode && cd .. && cd reactive && deno task coverage:html && mv coverage/html ../coverage/reactive && cd .. && cd run && deno task coverage:html && mv coverage/html ../coverage/run && cd .. && cd std && deno task coverage:html && mv coverage/html ../coverage/std && cd .. && cd testing && deno task coverage:html && mv coverage/html ../coverage/testing && cd .. && cd typing && deno task coverage:html && mv coverage/html ../coverage/typing && cd .. && cd xml && deno task coverage:html && mv coverage/html ../coverage/xml && cd .."
"test": "cd bundle && deno task test:deno && cd .. && cd crypto && deno task test:deno && cd .. && cd diff && deno task test:deno && cd .. && cd dom && deno task test:deno && cd .. && cd logger && deno task test:deno && cd .. && cd markdown && deno task test:deno && cd .. && cd orm && deno task test:deno && cd .. && cd qrcode && deno task test:deno && cd .. && cd reactive && deno task test:deno && cd .. && cd run && deno task test:deno && cd .. && cd std && deno task test:deno && cd .. && cd testing && deno task test:deno && cd .. && cd typing && deno task test:deno && cd .. && cd xml && deno task test:deno && cd ..",
"lint": "cd bundle && deno task lint && cd .. && cd crypto && deno task lint && cd .. && cd diff && deno task lint && cd .. && cd dom && deno task lint && cd .. && cd logger && deno task lint && cd .. && cd markdown && deno task lint && cd .. && cd orm && deno task lint && cd .. && cd qrcode && deno task lint && cd .. && cd reactive && deno task lint && cd .. && cd run && deno task lint && cd .. && cd std && deno task lint && cd .. && cd testing && deno task lint && cd .. && cd typing && deno task lint && cd .. && cd xml && deno task lint && cd ..",
"coverage": "rm -rf coverage && mkdir -p coverage && cd bundle && deno task coverage:html && mv coverage/html ../coverage/bundle && cd .. && cd crypto && deno task coverage:html && mv coverage/html ../coverage/crypto && cd .. && cd diff && deno task coverage:html && mv coverage/html ../coverage/diff && cd .. && cd dom && deno task coverage:html && mv coverage/html ../coverage/dom && cd .. && cd logger && deno task coverage:html && mv coverage/html ../coverage/logger && cd .. && cd markdown && deno task coverage:html && mv coverage/html ../coverage/markdown && cd .. && cd orm && deno task coverage:html && mv coverage/html ../coverage/orm && cd .. && cd qrcode && deno task coverage:html && mv coverage/html ../coverage/qrcode && cd .. && cd reactive && deno task coverage:html && mv coverage/html ../coverage/reactive && cd .. && cd run && deno task coverage:html && mv coverage/html ../coverage/run && cd .. && cd std && deno task coverage:html && mv coverage/html ../coverage/std && cd .. && cd testing && deno task coverage:html && mv coverage/html ../coverage/testing && cd .. && cd typing && deno task coverage:html && mv coverage/html ../coverage/typing && cd .. && cd xml && deno task coverage:html && mv coverage/html ../coverage/xml && cd .."
},
"lint": {
"rules": {
Expand Down
29 changes: 29 additions & 0 deletions markdown/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# 🖨️ Markdown

[![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)
[![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)

- [`🦕 Playground`](https://libs.lecoq.io/markdown)
- [`📚 Documentation`](https://jsr.io/@libs/markdown/doc)

## ✨ Features

- Render markdown to HTML using the [unified ecosystem](https://unifiedjs.com).
- Straightforward API for both basic markdown and extended markdown rendering
- Support out-of-the-box dozen of plugins to add extended markdown features
- Headings anchors
- Frontmatter
- Code highlighting
- Math
- Mermaid diagrams
- Wiki links
- etc.

## 📜 Licenses and credits

```plaintext
Copyright (c) Simon Lecoq <@lowlighter>. (MIT License)
https://github.com/lowlighter/libs/blob/main/LICENSE
```

This library rely on the awesome [unified ecosystem](https://unifiedjs.com).
119 changes: 119 additions & 0 deletions markdown/deno.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
{
"icon": "🖨️",
"name": "@libs/markdown",
"version": "0.0.0",
"description": "Markdown renderer with optional plugins based on the unified ecosystem.",
"keywords": [
"markdown",
"plugins",
"gfm",
"github-flavored-markdown",
"unified",
"remark",
"rehype"
],
"license": "MIT",
"author": "lowlighter (Simon Lecoq)",
"funding": "https://github.com/sponsors/lowlighter",
"homepage": "https://github.com/lowlighter/libs",
"playground": "https://libs.lecoq.io/markdown",
"supported": [
"deno"
],
"repository": {
"type": "git",
"url": "git+https://github.com/lowlighter/libs.git"
},
"npm": true,
"exports": {
".": "./mod.ts",
"./renderer": "./renderer.ts",
"./plugins/anchors": "./plugins/anchors.ts",
"./plugins/highlighting": "./plugins/highlighting.ts",
"./plugins/directives": "./plugins/directives.ts",
"./plugins/emojis": "./plugins/emojis.ts",
"./plugins/frontmatter": "./plugins/frontmatter.ts",
"./plugins/gfm": "./plugins/gfm.ts",
"./plugins/linebreaks": "./plugins/linebreaks.ts",
"./plugins/markers": "./plugins/markers.ts",
"./plugins/uncomments": "./plugins/uncomments.ts",
"./plugins/ruby": "./plugins/ruby.ts",
"./plugins/sanitize": "./plugins/sanitize.ts",
"./plugins/wikilinks": "./plugins/wikilinks.ts"
},
"imports": {
"unified": "npm:unified@11",
"hast": "npm:@types/hast@3",
"hastscript": "npm:hastscript@9",
"unist-util-visit": "npm:unist-util-visit@5",
"rehype-slug": "npm:rehype-slug@6",
"rehype-autolink-headings": "npm:rehype-autolink-headings@7",
"rehype-highlight": "npm:rehype-highlight@7",
"rehype-raw": "npm:rehype-raw@7",
"rehype-sanitize": "npm:rehype-sanitize@6",
"rehype-stringify": "npm:rehype-stringify@10",
"remark-breaks": "npm:remark-breaks@4",
"remark-flexible-markers": "npm:remark-flexible-markers@1",
"remark-wiki-link": "npm:remark-wiki-link@2",
"remark-gfm": "npm:remark-gfm@4",
"remark-parse": "npm:remark-parse@11",
"remark-rehype": "npm:remark-rehype@11",
"remark-directive": "npm:remark-directive@3",
"remark-ruby": "npm:[email protected]",
"remark-frontmatter": "npm:remark-frontmatter@5",
"remark-emoji": "npm:remark-emoji@5",
"remark-remove-comments": "npm:remark-remove-comments@1",
"remark-math": "npm:remark-math@6",
"rehype-mathjax": "npm:rehype-mathjax@6",
"rehype-mermaid": "npm:rehype-mermaid@2",
"@std/text/slugify": "jsr:@std/text@1/slugify",
"@std/yaml/parse": "jsr:@std/yaml@1/parse",
"@libs/testing": "jsr:@libs/testing@2",
"@libs/typing": "jsr:@libs/typing@2"
},
"test:permissions": {
"read": true,
"env": true,
"write": true,
"sys": true,
"run": true
},
"tasks": {
"build": "npx playwright-core install --with-deps chromium",
"test": "deno test --allow-read --allow-env --allow-write --allow-sys --allow-run --no-prompt --coverage --clean --trace-leaks --doc",
"test:deno": "deno fmt --check && deno task test --filter='/^\\[deno\\]/' --quiet && deno coverage --exclude=.js && deno lint",
"test:deno-future": "DENO_FUTURE=1 && deno task test:deno",
"test:others": "deno fmt --check && deno task test --filter='/^\\[node|bun \\]/' --quiet && deno coverage --exclude=.js && deno lint",
"coverage:html": "deno task test --filter='/^\\[deno\\]/' --quiet && deno coverage --exclude=.js --html && sleep 1",
"dev": "deno fmt && deno task test --filter='/^\\[deno\\]/' && deno coverage --exclude=.js --detailed && deno task lint",
"lint": "deno fmt --check && deno lint && deno doc --lint mod.ts && deno publish --dry-run --quiet --allow-dirty"
},
"lint": {
"rules": {
"include": [
"no-throw-literal",
"no-eval",
"eqeqeq",
"ban-untagged-todo"
]
},
"exclude": [
"**/wasm_*",
"**/*.mjs"
]
},
"fmt": {
"lineWidth": 280,
"semiColons": false,
"exclude": [
"coverage",
"**/coverage",
"**/node_modules",
"**/package.json",
"**/package-lock.json",
"**/wasm_*",
"**/*.mjs"
],
"proseWrap": "preserve"
}
}
Loading

0 comments on commit 9bc0375

Please sign in to comment.