Installation
Requirements
- Node.js >= 18.0.0
- npm, yarn, or pnpm
Package Installation
npm
bash
npm install wiremdyarn
bash
yarn add wiremdpnpm
bash
pnpm add wiremdGlobal CLI Installation
To use the wiremd command globally:
bash
npm install -g wiremdVerify installation:
bash
wiremd --versionDevelopment Installation
To contribute to wiremd or run from source:
bash
# Clone the repository
git clone https://github.com/akonan/wiremd.git
cd wiremd
# Install dependencies
npm install
# Build the project
npm run build
# Run tests
npm test
# Link globally for development
npm linkVerify Installation
Using the CLI
bash
# Create a test file
echo "## Test\n[Button]" > test.md
# Render it
wiremd test.md
# Should create test.htmlUsing the API
Create a test script test.js:
javascript
import { parse, renderToHTML } from 'wiremd';
const ast = parse('## Test\n[Button]');
const html = renderToHTML(ast);
console.log('Success! wiremd is installed.');Run it:
bash
node test.jsTypeScript Support
wiremd is written in TypeScript and includes type definitions. No additional @types package is needed.
typescript
import type { DocumentNode, WiremdNode } from 'wiremd';Troubleshooting
Module not found
If you see "Cannot find module 'wiremd'":
- Ensure you're in the correct directory
- Run
npm installagain - Check that
node_modules/wiremdexists
Permission errors (global install)
On macOS/Linux, you may need sudo:
bash
sudo npm install -g wiremdOr configure npm to use a different directory:
bash
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATHNode version issues
Check your Node version:
bash
node --versionIf it's less than 18.0.0, upgrade Node.js.