Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
markio
Advanced tools
Readme
Markio is a custom Markdown rendering package for Express that can handle Markdown input from a file or a block of text in the main file.
You can install Markio using NPM:
npm install markio
Usage To use Markio in an Express application, first require the package and add the markioMiddleware middleware to your application:
const express = require("express");
const markio = require("markio");
const app = express();
app.use(markio.markioMiddleware);
app.get("/", (req, res) => {
res.locals.data = "# Hello, world!";
res.render("index");
});
app.get("/file", (req, res) => {
res.locals.data = { filename: "example.md" };
res.render("index");
});
In this example, we're setting the data
variable in res.locals
to a Markdown string in the "/"
route handler, while in the "/file"
route handler, we're setting it to an object with a filename
property that points to a Markdown file.
When the markioMiddleware
middleware is called for a GET
request with the format
query parameter set to md
, it will check the type of res.locals.data
and render the corresponding Markdown input.
Markio exports two functions:
renderMarkdown(input: string): string
Renders the given Markdown input string and returns the resulting HTML string.
markioMiddleware(req: Request, res: Response, next: NextFunction): void
Express middleware that checks if the format
query parameter is set to md
and renders the corresponding Markdown input in the response. If res.locals.data
is a string, it is assumed to contain Markdown input. If it is an object with a filename
property, the contents of the file with the specified filename are read and assumed to contain Markdown input. If res.locals.data
is not a string or an object with a filename
property, the next middleware in the chain is called.
Markio is released under the ISC License. See LICENSE
for details.
FAQs
A custom Markdown rendering package for Express
We found that markio 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.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).