@bio-x/markdown
v0.0.44
Published
Render Markdown to HTML, BioX-style
Readme
@bio-x/markdown
Render Markdown to HTML, BioX-style.
Documentation
📖 Full Documentation - Complete usage guide, API reference, and tutorials
Documentation Sections
- 📦 Package Docs - Installation, features, and usage
- 🔧 API Reference - Complete API documentation
- 📚 Tutorials - Integration guides
- 📐 LaTeX Support - Mathematical equations
Installation
Choose your preferred package manager:
npm install @bio-x/markdown
# or
yarn add @bio-x/markdown
# or
bun add @bio-x/markdown # Fastest
# or
pnpm add @bio-x/markdownSee Installation Guide for detailed instructions.
Quick Start
import md from '@bio-x/markdown'
const markdown = `# Hello World
\`\`\`js
console.log('Hello from BioX!')
\`\`\`
`
const html = await md(markdown)
console.log(html)Features
- ✅ LaTeX Support - KaTeX for PhD-level mathematical equations
- ✅ Video URLs - Auto-convert to expandable
<details>elements - ✅ Syntax Highlighting - Prism.js for 100+ programming languages
- ✅ Smart Links - Automatic internal/external classification
- ✅ Heading Anchors - GitHub-style anchor links
- ✅ sh → shell - Automatic code block conversion
See Features Overview for complete feature documentation.
Usage
This package does not include any frontend code, such as React or CSS.
This package is designed for rendering at build or otherwise on a server, not client-side— the bundle size is significant & it's not been optimized for performance.
Always use with await.
API Reference
| Param | Default | Description |
| ----------- | -------------- | --------------------------------------------------------------- |
| input | Req'd! | String. The Markdown text to transform. |
| filePath | '/README.md' | String. The Markdown's path (for fixing relative image links). |
| imagePrefix | '/' | String. A prefix for the path to relative images. |
| removeTitle | false | Bool. Remove starting h1 (if titles are rendered separately). |
See Full API Reference for complete API documentation.
Frontmatter
If you need to parse frontmatter, we recommend using gray-matter
alongside BioX-markdown, but it's not included in this package.
Publishing (Maintainers)
This package uses Bun for the fastest publishing workflow.
Requirements
- Bun runtime installed
- NPM registry access token (
NPM_TOKEN) - Write access to
@bio-x/markdownpackage
Publishing Workflow
# Set your NPM token
export NPM_TOKEN=your_npm_token
# Option 1: Publish with automatic patch version bump
./publish.sh --bump patch
# Option 2: Publish with minor version bump
./publish.sh --bump minor
# Option 3: Publish without version bump
./publish.sh
# Option 4: Test publish workflow (dry run)
./publish.sh --dry-runPublishing Steps
The publish.sh script automates the following workflow:
- Install dependencies with
bun install(fast, efficient) - Build project - Generates CJS, ESM, and UMD bundles
- Run tests - Validates package functionality
- Bump version (optional) - Increments package.json version
- Publish to npm - Uploads to npm registry using
bun publish
Flags
--dry-run- Test the workflow without publishing--bump <type>- Version bump:patch,minor, ormajor--no-confirm- Skip confirmation prompt-h, --help- Show help message
Authentication
Pass token as argument:
./publish.sh --bump patch npm_XXXXXXXOr use environment variable:
export NPM_TOKEN=npm_XXXXXXX
./publish.sh --bump patchWhy Bun?
- 2-3x faster dependency installation
- Native npm publishing with full registry compatibility
- Same authentication - uses standard
.npmrctokens - All standard flags -
--access,--dry-run,--otpsupported
Links
- 📖 Documentation - Full documentation site
- 📦 Package Docs - Installation and features
- 🔧 API Reference - Complete API docs
- 📚 Tutorials - Integration guides
- 🐙 GitHub - Source code & issues
- 📦 npm - Package page
- 📐 KaTeX Docs - LaTeX API reference
Partially based on the Next.js documentation site.
MIT License
