UNPKG

markdown-to-jsx

Version:

Convert markdown to JSX with ease for React and React-like projects. Super lightweight and highly configurable.

155 lines (154 loc) 6.21 kB
{ "name": "markdown-to-jsx", "description": "Convert markdown to JSX with ease for React and React-like projects. Super lightweight and highly configurable.", "homepage": "https://markdown-to-jsx.quantizor.dev", "license": "MIT", "version": "8.0.0", "publishConfig": { "access": "public", "mangle": { "regex": "^_", "reserved": [ "__html" ], "compress": { "unsafe": true } } }, "engines": { "node": ">= 10" }, "keywords": [ "markdown", "markdown converter", "react", "preact", "jsx", "html" ], "author": "Evan Jacobs <x@quantizor.dev>", "repository": { "type": "git", "url": "git+https://github.com/quantizor/markdown-to-jsx.git" }, "bugs": "https://github.com/quantizor/markdown-to-jsx/issues", "files": [ "dist", "LICENSE", "README.md", "package.json" ], "type": "module", "exports": { ".": { "import": { "types": "./dist/index.d.ts", "node": "./dist/index.module.js", "default": "./dist/index.modern.js" }, "require": { "types": "./dist/index.cjs.d.ts", "default": "./dist/index.cjs" } } }, "sideEffects": false, "main": "dist/index.cjs", "module": "dist/index.module.js", "source": "index.tsx", "unpkg": "./dist/index.umd.js", "types": "dist/index.d.ts", "devDependencies": { "@babel/plugin-proposal-nullish-coalescing-operator": "^7.18.6", "@babel/plugin-proposal-object-rest-spread": "^7.20.7", "@babel/plugin-proposal-optional-chaining": "^7.21.0", "@babel/plugin-transform-typescript": "^7.23.6", "@changesets/cli": "^2.27.1", "@matejmazur/react-katex": "^3.1.3", "@size-limit/preset-small-lib": "^11.0.1", "@types/jest": "^29.5.11", "@types/node": "^20.10.6", "@types/react": "^17.0.74", "benchtable": "^0.1.0", "cli-progress": "^3.12.0", "in-publish": "^2.0.1", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", "jest-serializer-html": "^7.1.0", "jest-watch-typeahead": "^2.2.2", "markdown-it": "^14.0.0", "markdown-to-jsx-latest": "npm:markdown-to-jsx@7.7.16", "microbundle": "^0.15.1", "microtime": "^3.1.1", "mkdirp": "^3.0.1", "preact": "^10.19.3", "prettier": "^2.0.0", "react": "^17.0.2", "react-dom": "^17.0.2", "rimraf": "^5.0.5", "simple-markdown": "^0.7.3", "size-limit": "^11.0.1", "styled-components": "^6.1.6", "theredoc": "^1.0.0", "ts-jest": "^29.1.1", "typescript": "^5.9.3" }, "peerDependencies": { "react": ">= 0.14.0" }, "peerDependenciesMeta": { "react": { "optional": true } }, "scripts": { "prepublish": "in-publish && npm run build && npm run release || not-in-publish", "prebuild": "rimraf dist && mkdirp dist", "build": "microbundle --tsconfig tsconfig.json -f cjs,umd index.cjs.tsx --name MarkdownToJSX --define process.env.NODE_ENV=production,process.env.DEBUG=0 --globals react=React && microbundle --tsconfig tsconfig.json -f es,modern --name MarkdownToJSX --define process.env.NODE_ENV=production,process.env.DEBUG=0 && microbundle --tsconfig tsconfig.json -f es --define process.env.NODE_ENV=production --no-compress -o dist/debug.mjs", "build-site": "microbundle site.tsx -o docs -f iife --tsconfig tsconfig.site.json --define process.env.NODE_ENV=production,process.env.DEBUG=0 --jsx React.createElement --external react,react-dom,styled-components,katex --globals react=React,react-dom=ReactDOM,styled-components=styled --no-pkg-main", "dev": "microbundle watch site.tsx -o docs -f iife --tsconfig tsconfig.site.json --define process.env.NODE_ENV=development --jsx React.createElement --external react,react-dom,styled-components,katex --globals react=React,react-dom=ReactDOM,styled-components=styled --no-pkg-main", "dev:debug": "microbundle watch --tsconfig tsconfig.json -f es --define process.env.NODE_ENV=production --no-compress -o dist/debug.mjs", "test": "jest --verbose", "test:fuzz": "jest fuzz.spec.ts --verbose", "metrics": "DEBUG=\"${DEBUG:-1}\" bun --expose-gc -e \"import fs from 'fs';import {performance}from 'perf_hooks';import {compiler} from './index.tsx';const markdown=fs.readFileSync('fixture.md','utf8');if(gc)gc();const baseline=process.memoryUsage();const before=process.memoryUsage();const t0=performance.now();compiler(markdown);const t1=performance.now();const during=process.memoryUsage();if(gc)gc();const after=process.memoryUsage();console.log('='.repeat(50));console.log('Input size:',Math.round(markdown.length/1024)+'KB');console.log('Parse time:',(t1-t0).toFixed(2)+'ms');console.log('='.repeat(50));console.log('Memory Usage:');console.log(' Baseline (Node + imports):',Math.round(baseline.heapUsed/1024)+'KB');console.log(' Peak (during parse):',Math.round(during.heapUsed/1024)+'KB');console.log(' Final (after GC):',Math.round(after.heapUsed/1024)+'KB');console.log('='.repeat(50));console.log('True Delta:');console.log(' Parsing allocated:',Math.round((during.heapUsed-before.heapUsed)/1024)+'KB');console.log(' GC freed:',Math.round((during.heapUsed-after.heapUsed)/1024)+'KB');console.log(' Final overhead:',Math.round((after.heapUsed-before.heapUsed)/1024)+'KB');console.log('='.repeat(50));\"", "profile": "node --cpu-prof --expose-gc profile.js && node profile.post.js", "size": "size-limit", "benchmark": "node benchmark.js", "benchmark:all": "node benchmark.js --all", "changeset-publish": "bun run build && changeset publish" }, "size-limit": [ { "path": "./dist/index.module.js", "limit": "8 kB" }, { "path": "./dist/index.modern.js", "limit": "8 kB" } ], "jest": { "clearMocks": true, "testEnvironment": "jsdom", "transform": { "^.+\\.[tj]sx?$": [ "ts-jest", { "diagnostics": { "ignoreCodes": [ "TS151001" ] } } ] }, "snapshotSerializers": [ "jest-serializer-html" ], "watchPlugins": [ "jest-watch-typeahead/filename", "jest-watch-typeahead/testname" ] } }