
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
express-markdown-reloaded
Advanced tools
Express middleware for rendering markdown files
It looks for URLs ending in ".md" or ".markdown", example: http://mysite.com/README.md
supports:
npm install express-markdown-reloaded --save
or
git clone https://github.com/HansHammel/express-markdown-reloaded.git
cd express-markdown-reloaded
npm install
cd example
npm install
npm start
or
npm install "git+https://git@github.com/HansHammel/express-markdown-reloaded.git" --save
var expressmarkdown = require('express-markdown-reloaded');
//optional
var highlightjs = require('highlight.js');
// optional
// set view engine
app.set('views', path.join(__dirname, 'views'));
// set .ejs as the default extension
app.set('view engine', 'ejs');
// !!!IMPORTANT: place this before static or similar middleware
app.use('/docs',expressmarkdown({
// directory where markdown files are stored
// required
directory: path.join(__dirname,'/docs'),
// case sensitive/ camel case routing, defaults to lower case
// optional
// app.get('case sensitive routing') -> use express settings
caseSensitive: app.get('case sensitive routing'),
// view to use for rendering markdown files with a view engine
// e.g with an ejs template -> full html page
// optional
// default is undefined, no view -> raw html content
view: 'markdown',
// include raw text in hidden div
includerawtext: true,
// load epic editor, for use with markdown_epiceditor.ejs
loadepiceditor: true,
//optional
// options for marked (see [https://github.com/chjj/marked](https://github.com/chjj/marked))
// tip: skip the server side highlighting function and use markdown_advanced.ejs with client
// side code highlighting and line numbers !!!
marked: {
renderer: new marked.Renderer(),
gfm: true,
tables: true,
breaks: false,
pedantic: false,
sanitize: true,
smartLists: true,
smartypants: false,
highlight: function (code) {
return highlightjs.highlightAuto(code).value;
}
},
// variable passed in the context when rendering with a view engine
// optional
// e.g a title, js- and css- script may be passed in, and, raw css
// and/or js can be executed, depending on your template (see markdown.ejs)
context: {
stylesheeturl: 'http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.0/styles/googlecode.min.css',
styleraw: '',
title: 'Markdown',
//script: 'http://cdnjs.cloudflare.com/ajax/libs/highlight.js/8.0/highlight.min.js',
jsraw: '',
jsscripturl: ''
}
}));
// now the static middleware
app.use('/docs',express.static(path.join(__dirname,'docs'), { maxAge: 0 }));
// optional
// and maybe we want to list the files
app.use('/docs',express.directory(path.join(__dirname,'docs'), { icons:true }));
sample ejs template for your view directory (markdown.ejs)
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><%= title %></title>
<link rel="stylesheet" href='<%= stylesheeturl %>'>
<style>
<%- styleraw %>
</style>
</head>
<body>
<div class="container">
<%- content %>
</div>
<script defer="defer" type="text/javascript" src='<%= jsscripturl %>'></script>
<script defer="defer" ><%= jsraw %></script>
</body>
</html>
if you would like to help improving this module, please:
FAQs
Express middleware for rendering markdown files
The npm package express-markdown-reloaded receives a total of 2 weekly downloads. As such, express-markdown-reloaded popularity was classified as not popular.
We found that express-markdown-reloaded demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.