Node.js implementation of the @verikami/remark-deflist-revisited
module, demonstrating enhanced definition lists processing in markdown with full HTML output.
Remark Deflist Revisited is a Remark plugin. A wrapper around remark-deflist
with improved support for nested definition lists. It preserves all the original functionality and performs additional processing.
This project provides a Express.js equivalent of the Cloudflare Worker example, showcasing how to use remark-deflist-revisited
in a Node.js environment with Express.js server and modular processing capabilities. Astro and Simple example is also available.
- Full Markdown Processing: Convert markdown with definition lists to HTML
- Enhanced Definition Lists: Support for complex nested structures
- Express.js Server: RESTful API endpoints for markdown processing
- Modular Design: Reusable processor class for integration into other projects
- Beautiful Styling: Professional CSS styling with gradient background
- Error Handling: Comprehensive error handling and validation
- Node.js 20 or higher
- npm, pnpm or yarn
## Clone or download this project
ツ git clone git@github.com:veriKami/remark-deflist-revisited-express.git
## Install dependencies
ツ npm install
## Start the development server
ツ npm start
## Or run with watch mode
ツ npm run dev
The server will start on http://localhost:3000
- Description: Returns a demo page with pre-processed markdown
- Response: HTML page with styled content
- Description: Process custom markdown and return full HTML page
- Body:
{ "markdown": "Your markdown content here" }
- Response: Complete HTML page with styling
- Description: Process custom markdown and return JSON response
- Body:
{ "markdown": "Your markdown content here" }
- Response:
{ "html": "<p>Processed HTML</p>", "processed": true }
## Demo page
ツ curl http://localhost:3000
## Process custom markdown (returns HTML)
ツ curl -X POST http://localhost:3000/process \
-H "Content-Type: application/json" \
-d '{"markdown": "# Title\n\nTerm\n: Definition"}'
## Process custom markdown (returns JSON)
ツ curl -X POST http://localhost:3000/api/process \
-H "Content-Type: application/json" \
-d '{"markdown": "# Title\n\nTerm\n: Definition"}'
import { MarkdownProcessor } from './lib/markdown.processor.js';
const processor = new MarkdownProcessor();
//: Process to plain HTML
//: -----------------------------------------
const html = await processor.process(`
# Example
Cloudflare Workers
: Serverless platform
: Runs on the edge
`);
//: Process to full HTML page
//: -----------------------------------------
const page = await processor.processToHTML(`
# Example Page
Node.js
: JavaScript runtime
: Event-driven architecture
`, {
title: 'My Custom Title',
includeStyles: true
});
.
├── lib/markdown.processor.js # Modular markdown processor class
├── server.js # Express.js server implementation
├── package.json # Dependencies and scripts
└── README.md # This file
@verikami/remark-deflist-revisited
→ Enhanced definition lists for remarkexpress
→ Web server frameworkremark
→ Markdown processorremark-html
→ HTML serializer for remarkdedent
→ Dedent template strings
Feature | Express.js | Astro Integration | Cloudflare Worker |
---|---|---|---|
Rendering | Server-side | SSG/SSR | Edge |
Build Time | Runtime | Pre-built at deploy | Runtime |
Performance | Good | Excellent (static) | Excellent (edge) |
Complexity | Medium | Low | Low |
Use Case | Dynamic apps | Documentation sites | API endpoints |
- Extend the
MarkdownProcessor
class with new methods - Add new routes to
server.js
- Update error handling as needed
Modify the getStyles()
method in markdown.processor.js
to customize the appearance:
getStyles() {
return `
<style>
/* Your custom CSS here */
</style>
`;
}
This project is Open Source and available under the MIT License
2025 © MIT °// veriKami °// Weronika Kami