{"_id":"@adamjanicki/markdown","name":"@adamjanicki/markdown","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@adamjanicki/markdown","version":"1.0.0","description":"A component for converting Markdown into React","type":"module","main":"./build/index.js","module":"./build/index.js","types":"./build/index.d.ts","sideEffects":false,"author":{"name":"Adam Janicki"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/adamjanicki2/markdown.git"},"scripts":{"lint":"eslint src test --fix && prettier --write \"src/**/*.{ts,tsx,json,md}\" \"test/**/*.{ts,tsx}\"","test":"jest --silent","build":"npm test && eslint src test --max-warnings=0 && python3 ./build.py","prepare":"npm run build"},"peerDependencies":{"react":">=19"},"devDependencies":{"@testing-library/jest-dom":"^6.7.0","@testing-library/react":"^16.3.0","@testing-library/user-event":"^14.6.1","@types/jest":"^30.0.0","@types/react":"^19.0.0","esbuild":"^0.27.2","jest":"^30.0.5","jest-environment-jsdom":"^30.0.5","ts-jest":"^29.4.1","typescript":"^5.9.2"},"_id":"@adamjanicki/markdown@1.0.0","gitHead":"fba03f3c810247d49f4353ab767e38c3f6f6c372","bugs":{"url":"https://github.com/adamjanicki2/markdown/issues"},"homepage":"https://github.com/adamjanicki2/markdown#readme","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-ELrdNSzJB7Dd3yRUA3HtN8cJvavwRGyGGVVAaGv9c37rO7B/dx+nt/UGbGf5wTWmWeEfROGBlBzLGBxC1wZkfg==","shasum":"fba3c1571e61beefc1c2c8305e7e3e83d7e3747c","tarball":"https://registry.npmjs.org/@adamjanicki/markdown/-/markdown-1.0.0.tgz","fileCount":9,"unpackedSize":26121,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDxgXdhGItC90A0aOZPubKQ4TcYQziwU9QKenkkvFgN7QIgIDLWlV3y639eXulkVwX+0+SROi7VwLFK5dBzfY7Wmzk="}]},"_npmUser":{"name":"adamjanicki","email":"adamjanicki2@gmail.com"},"directories":{},"maintainers":[{"name":"adamjanicki","email":"adamjanicki2@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/markdown_1.0.0_1769836486838_0.8722098141597301"},"_hasShrinkwrap":false}},"time":{"created":"2026-01-31T05:14:46.699Z","1.0.0":"2026-01-31T05:14:46.990Z","modified":"2026-01-31T05:14:47.189Z"},"maintainers":[{"name":"adamjanicki","email":"adamjanicki2@gmail.com"}],"description":"A component for converting Markdown into React","homepage":"https://github.com/adamjanicki2/markdown#readme","repository":{"type":"git","url":"git+https://github.com/adamjanicki2/markdown.git"},"author":{"name":"Adam Janicki"},"bugs":{"url":"https://github.com/adamjanicki2/markdown/issues"},"license":"MIT","readme":"# @adamjanicki/markdown\n\nA lightweight and customizable Markdown to React renderer.\n\n## Overview\n\nThis library is not a strict CommonMark implementation; it supports the majority of it with an added subset of GitHub Flavored Markdown (GFM) with some intentional omissions for security and simplicity. It's unique in its own way; it's _Adamarkdown_ syntax. I built this for fun, so use with caution, there are likely small bugs, and slight mismatches between outputs of this and a true commonmark parser.\n\n## Installation\n\n```bash\nnpm install @adamjanicki/markdown\n```\n\n## Quick Start\n\n```tsx\nimport Markdown from \"@adamjanicki/markdown\";\n\nfunction App() {\n  return <Markdown>{\"# Hello World\\n\\nThis is **bold** text.\"}</Markdown>;\n}\n```\n\n## Supported Features\n\n| Feature              | Syntax                             |\n| -------------------- | ---------------------------------- |\n| **Bold**             | `**text**` or `__text__`           |\n| **Italic**           | `*text*` or `_text_`               |\n| **Strikethrough**    | `~~text~~` (GFM)                   |\n| **Inline Code**      | `` `code` ``                       |\n| **Links**            | `[text](url)`                      |\n| **Images**           | `![alt](url)`                      |\n| **Headings**         | `#` through `######`               |\n| **Horizontal Rules** | `---`, `***`, or `___`             |\n| **Code Fences**      | ` ```lang\\ncode\\n``` `             |\n| **Blockquotes**      | `> text`                           |\n| **Unordered Lists**  | `- item`                           |\n| **Ordered Lists**    | `1. item` (preserves start number) |\n| **Tables**           | GFM pipe tables with alignment     |\n| **Hard Breaks**      | Two spaces + newline               |\n\n## Unsupported Features\n\nNotable omissions by design:\n\n- Raw HTML (security)\n- Reference-style links\n- Indented code blocks (use fenced ` ``` ` instead)\n- Setext headings (use `#` instead)\n- Task lists\n- Footnotes\n- Autolinks\n\n## Security\n\nOn the plus side, I intentionally did not support raw HTML, so you're safe from anything like that, meaning the only two XSS vulnerabilities come from URLs of image `src`s and anchor `href`. **I do not do any sanitization or filtering out of the box; you will have to implement that yourself using a custom renderer, or you can choose to drop/unwrap links.**\n\n## Examples\n\n### Custom Code Block\n\n```tsx\nimport Markdown from \"@adamjanicki/markdown\";\n\n<Markdown\n  renderers={{\n    pre: ({ children, lang }) => (\n      <CodeBlock language={lang}>{children}</CodeBlock>\n    ),\n  }}\n>\n  {markdownWithCode}\n</Markdown>;\n```\n\n### Link Sanitization\n\n```tsx\n<Markdown\n  renderers={{\n    a: ({ children, href }) =>\n      href.startsWith(\"https://\") ? (\n        <a href={href} target=\"_blank\" rel=\"noopener noreferrer\">\n          {children}\n        </a>\n      ) : (\n        <span>{children}</span>\n      ),\n  }}\n>\n  {markdown}\n</Markdown>\n```\n\n### Custom Syntax Extensions\n\n```tsx\n<Markdown\n  inlineExtensions={[\n    {\n      token: \"==\",\n      intraword: true,\n      renderer: ({ children }) => <mark>{children}</mark>,\n    },\n    {\n      token: \"^^\",\n      intraword: true,\n      renderer: ({ children }) => <sup>{children}</sup>,\n    },\n    {\n      token: \"%%\",\n      intraword: false,\n      renderer: ({ children }) => <small>{children}</small>,\n    },\n  ]}\n>\n  {\"Text with ==highlight==, ^^superscript^^, and %%small%% text\"}\n</Markdown>\n```\n\n_Want to play around with the component? Head over to the_ [Playground](https://adamjanicki.xyz/markdown#playground)\n","readmeFilename":"README.md","_rev":"1-77647964d260a949dcccfb542aa952ff"}