markdansi 0.1.3 → 0.1.4

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 (3) hide show
  1. package/README.md +23 -7
  2. package/dist/cli.js +0 -0
  3. package/package.json +77 -74
package/README.md CHANGED
@@ -1,4 +1,9 @@
1
1
  # 🎨 Markdansi: Wraps, colors, links—no baggage.
2
+
3
+ <p align="center">
4
+ <img src="./markdansi.png" alt="Markdansi README header" width="1100">
5
+ </p>
6
+
2
7
  ![npm](https://img.shields.io/npm/v/markdansi) ![license MIT](https://img.shields.io/badge/license-MIT-blue.svg) ![node >=22](https://img.shields.io/badge/node-%3E%3D22-brightgreen) ![tests vitest](https://img.shields.io/badge/tests-vitest-blue?logo=vitest)
3
8
 
4
9
  Tiny, dependency-light Markdown → ANSI renderer and CLI for modern Node (>=22). Focuses on readable terminal output with sensible wrapping, GFM support (tables, task lists, strikethrough), optional OSC‑8 hyperlinks, and zero built‑in syntax highlighting (pluggable hook). Written in TypeScript, ships ESM.
@@ -6,14 +11,18 @@ Tiny, dependency-light Markdown → ANSI renderer and CLI for modern Node (>=22)
6
11
  Published on npm as `markdansi`.
7
12
 
8
13
  ## Install
14
+ Grab it from npm; no native deps, so install is instant on Node 22+.
9
15
 
10
16
  ```bash
17
+ bun add markdansi
18
+ # or
11
19
  pnpm add markdansi
12
20
  # or
13
21
  npm install markdansi
14
22
  ```
15
23
 
16
24
  ## CLI
25
+ Quick one-shot renderer: pipe Markdown in, ANSI comes out. Flags let you pick width, wrap, colors, links, and table/list styling.
17
26
 
18
27
  ```bash
19
28
  markdansi [--in FILE] [--out FILE] [--width N] [--no-wrap] [--no-color] [--no-links] [--theme default|dim|bright]
@@ -27,6 +36,15 @@ markdansi [--in FILE] [--out FILE] [--width N] [--no-wrap] [--no-color] [--no-li
27
36
  - Lists/quotes: `--list-indent` sets spaces per nesting level (default 2); `--quote-prefix` sets blockquote prefix (default `│ `).
28
37
 
29
38
  ## Library
39
+ Use the renderer directly in Node/TS for customizable theming, optional syntax highlighting hooks, and OSC‑8 link control.
40
+
41
+ ### ESM / CommonJS
42
+ Markdansi ships ESM (`"type":"module"`). If you’re in CommonJS (or a tool like `tsx` running your script as CJS), prefer dynamic import:
43
+
44
+ ```js
45
+ const { render } = await import('markdansi');
46
+ console.log(render('# hello'));
47
+ ```
30
48
 
31
49
  ```js
32
50
  import { render, createRenderer, strip, themes } from 'markdansi';
@@ -100,12 +118,6 @@ console.log(highlighted('```ts\nconst x: number = 1\n```\n```swift\nlet x = 1\n`
100
118
  - `codeBox`: draw a box around fenced code (default true); `codeGutter` shows line numbers; `codeWrap` wraps code lines by default.
101
119
  - `highlighter(code, lang)`: optional hook to recolor code blocks; must not add/remove newlines.
102
120
 
103
- ## Status
104
-
105
- Version: `0.1.2` (released)
106
- Tests: `pnpm test`
107
- License: MIT
108
-
109
121
  ## Notes
110
122
 
111
123
  - Code blocks wrap to the render width by default; disable with `codeWrap=false`. If `lang` is present, a faint `[lang]` label is shown and boxes use unicode borders.
@@ -113,4 +125,8 @@ License: MIT
113
125
  - Tables use unicode borders by default, include padding, respect GFM alignment, and truncate long cells with `…` so layouts stay tidy. Turn off truncation with `tableTruncate=false`.
114
126
  - Tight vs loose lists follow GFM; task items render `[ ]` / `[x]`.
115
127
 
116
- See `docs/spec.md` for full behavior details.*** End Patch
128
+ See [`docs/spec.md`](docs/spec.md) for full behavior details.
129
+
130
+ Looking for the Swift port? Check out [Swiftdansi](https://github.com/steipete/Swiftdansi).
131
+
132
+ MIT license.
package/dist/cli.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,75 +1,78 @@
1
1
  {
2
- "name": "markdansi",
3
- "version": "0.1.3",
4
- "description": "Tiny dependency-light markdown to ANSI converter.",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "exports": {
8
- ".": {
9
- "import": "./dist/index.js"
10
- },
11
- "./cli": "./dist/cli.js"
12
- },
13
- "bin": {
14
- "markdansi": "./dist/cli.js"
15
- },
16
- "keywords": [
17
- "markdown",
18
- "ansi",
19
- "terminal",
20
- "cli"
21
- ],
22
- "engines": {
23
- "node": ">=22"
24
- },
25
- "repository": {
26
- "type": "git",
27
- "url": "https://github.com/steipete/Markdansi.git"
28
- },
29
- "bugs": {
30
- "url": "https://github.com/steipete/Markdansi/issues"
31
- },
32
- "homepage": "https://github.com/steipete/Markdansi#readme",
33
- "author": "Peter Steinberger",
34
- "license": "MIT",
35
- "sideEffects": false,
36
- "files": [
37
- "dist",
38
- "README.md",
39
- "docs/spec.md",
40
- "package.json",
41
- "tsconfig.json",
42
- ".biome.json"
43
- ],
44
- "types": "dist/index.d.ts",
45
- "dependencies": {
46
- "chalk": "^5.6.2",
47
- "mdast-util-from-markdown": "^2.0.2",
48
- "mdast-util-gfm": "^3.1.0",
49
- "micromark": "^4.0.2",
50
- "micromark-extension-gfm": "^3.0.0",
51
- "micromark-util-combine-extensions": "^2.0.1",
52
- "string-width": "^8.1.0",
53
- "strip-ansi": "^7.1.2",
54
- "supports-hyperlinks": "^4.3.0"
55
- },
56
- "devDependencies": {
57
- "@biomejs/biome": "^2.3.5",
58
- "@types/mdast": "^4.0.4",
59
- "@types/node": "^24.10.1",
60
- "@vitest/coverage-v8": "^4.0.9",
61
- "tsx": "^4.20.6",
62
- "typescript": "^5.9.3",
63
- "vitest": "^4.0.9"
64
- },
65
- "scripts": {
66
- "build": "pnpm lint && pnpm test && pnpm compile",
67
- "clean": "rm -rf dist",
68
- "lint": "rm -rf dist coverage && biome check .",
69
- "test": "vitest run",
70
- "test:coverage": "vitest run --coverage",
71
- "types": "tsc -p tsconfig.json --emitDeclarationOnly",
72
- "compile": "tsc -p tsconfig.json",
73
- "markdansi": "tsx src/cli.ts"
74
- }
75
- }
2
+ "name": "markdansi",
3
+ "version": "0.1.4",
4
+ "description": "Tiny dependency-light markdown to ANSI converter.",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "exports": {
8
+ ".": {
9
+ "types": "./dist/index.d.ts",
10
+ "import": "./dist/index.js",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./cli": "./dist/cli.js"
14
+ },
15
+ "bin": {
16
+ "markdansi": "dist/cli.js"
17
+ },
18
+ "scripts": {
19
+ "build": "pnpm lint && pnpm test && pnpm compile",
20
+ "clean": "rm -rf dist",
21
+ "lint": "rm -rf dist coverage && biome check .",
22
+ "test": "vitest run",
23
+ "test:coverage": "vitest run --coverage",
24
+ "types": "tsc -p tsconfig.json --emitDeclarationOnly",
25
+ "compile": "tsc -p tsconfig.json",
26
+ "prepare": "pnpm compile",
27
+ "markdansi": "tsx src/cli.ts"
28
+ },
29
+ "keywords": [
30
+ "markdown",
31
+ "ansi",
32
+ "terminal",
33
+ "cli"
34
+ ],
35
+ "engines": {
36
+ "node": ">=22"
37
+ },
38
+ "repository": {
39
+ "type": "git",
40
+ "url": "git+https://github.com/steipete/Markdansi.git"
41
+ },
42
+ "bugs": {
43
+ "url": "https://github.com/steipete/Markdansi/issues"
44
+ },
45
+ "homepage": "https://github.com/steipete/Markdansi#readme",
46
+ "author": "Peter Steinberger",
47
+ "license": "MIT",
48
+ "sideEffects": false,
49
+ "files": [
50
+ "dist",
51
+ "README.md",
52
+ "docs/spec.md",
53
+ "package.json",
54
+ "tsconfig.json",
55
+ ".biome.json"
56
+ ],
57
+ "types": "dist/index.d.ts",
58
+ "dependencies": {
59
+ "chalk": "^5.6.2",
60
+ "mdast-util-from-markdown": "^2.0.2",
61
+ "mdast-util-gfm": "^3.1.0",
62
+ "micromark": "^4.0.2",
63
+ "micromark-extension-gfm": "^3.0.0",
64
+ "micromark-util-combine-extensions": "^2.0.1",
65
+ "string-width": "^8.1.0",
66
+ "strip-ansi": "^7.1.2",
67
+ "supports-hyperlinks": "^4.3.0"
68
+ },
69
+ "devDependencies": {
70
+ "@biomejs/biome": "^2.3.5",
71
+ "@types/mdast": "^4.0.4",
72
+ "@types/node": "^24.10.1",
73
+ "@vitest/coverage-v8": "^4.0.9",
74
+ "tsx": "^4.20.6",
75
+ "typescript": "^5.9.3",
76
+ "vitest": "^4.0.9"
77
+ }
78
+ }