down_render
v1.0.1
Published
A Markdown to HTML converter with tests
Downloads
2
Readme
Down_Render
A simple and secure Node.js utility that converts Markdown to HTML with built-in XSS protection.
Features
- Converts Markdown to clean, sanitized HTML
- Built-in XSS protection using
sanitize-html - Supports common Markdown elements:
- Headings (h1-h6)
- Bold and italic text
- Links
- Ordered and unordered lists
- Code blocks
- Blockquotes
- Tables
- Images
- Comprehensive test suite
- Input validation
Installation
npm install down_renderUsage
As a Module
const convertMarkdown = require('down_render');
// Convert Markdown to HTML
const markdown = '# Hello World\n\nThis is a **bold** text.';
const html = convertMarkdown(markdown);
console.log(html);Command Line Interface
mdtohtml input.md > output.htmlSecurity
This converter includes built-in XSS protection through sanitize-html. It only allows specific HTML tags and attributes:
Allowed HTML Tags
- Headings (h1-h6)
- Blockquotes
- Paragraphs
- Links
- Lists (ordered and unordered)
- List items
- Bold and italic text
- Code blocks
- Tables and related elements
- Images
Allowed Attributes
- Links: href, name, target
- Images: src, alt
Development
Running Tests
npm testThe test suite covers:
- Headings conversion
- Bold and italic text
- Links
- Lists (ordered and unordered)
- Code blocks
- Blockquotes
- Input validation
License
ISC
Contributing
- Fork the repository Github Repo
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Author
Ikegah Oliver A.
