Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
@datatraccorporation/markdown-it-mermaid
Advanced tools
Plugin to render mermaid diagrams in markdown-it
Mermaid plugin for markdown-it. (Forked from iradb2000/markdown-it-mermaid)
This version uses a different syntax to support mermaid. The syntax
uses the syntax highlighting notation by putting the word mermaid
directly after the opening fence marker.
npm install @DatatracCorporation/markdown-it-mermaid
import markdownIt from "markdown-it";
import markdownItMermaid from "@DatatracCorporation/markdown-it-mermaid";
const mdi = markdownIt();
mdi.use(markdownItMermaid);
mdi.render(`~~~mermaid optional title goes here
graph TD
A[Christmas] -->|Get money| B(Go shopping)
B --> C{Let me think}
C -->|One| D[Laptop]
C -->|Two| E[iPhone]
C -->|Three| F[Car]
~~~`);
The word mermaid
after the fence code block opening indicates that the
rest of the fenced block should be passed to mermaid for processing.
This example used the ~~~
fence marker since the multi-line string
in javascript is the same character,
but either ~~~
or ```
works.
Mermaid does not support titles on the diagrams today. We have added an
external title that you can use. Include the title on the code fence
line after the word mermaid
and it will be rendered as a div inside
the parent div as a sibling to the svg image. The title element has a
class of mermaid-title
so you can style the title to fit your app.
We use:
/* image container */
div.mermaid {
width: fit-content;
}
/* image title */
.mermaid-title {
width: fit-content;
margin: auto;
font-weight: 900;
font-size: 2em;
color: white;
padding-bottom: 0.5em;
}
/* image itself */
.mermaid > svg {
margin: auto;
display: block;
}
import MarkdownIt from 'markdown-it';
import MarkdownItKatex from '@DatatracCorporation/markdown-it-mermaid';
var md = MarkdownIt({
html: false,
linkify: true,
typographer: true,
breaks: true,
xhtmlOut: false,
});
md.use(MarkdownItMermaid,{
startOnLoad: false,
securityLevel: true,
theme: "default",
flowchart:{
htmlLabels: false,
useMaxWidth: true,
}
...or any options
})
At this time, there are no unit tests since mermaid has to run in a browser (uses document apis). At some point in the future, we might go with a headless browser.
npm version <newver> && npm publish
FAQs
Plugin to render mermaid diagrams in markdown-it
The npm package @datatraccorporation/markdown-it-mermaid receives a total of 0 weekly downloads. As such, @datatraccorporation/markdown-it-mermaid popularity was classified as not popular.
We found that @datatraccorporation/markdown-it-mermaid 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
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.