npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

remark-mermaid-ssr

v0.1.2

Published

Mermaid plugin for remark with server side rendering

Downloads

6

Readme

remark-mermaid-ssr

Remark plugin for rendering mermaid diagrams server-side. Installation is smoothly handled by this package; no other installations are required. Supports rendering of an additional dark mode SVGs.

This plugin uses puppeteer to launch a headless chromium browser instance to render diagrams using mermaidAPI. The codeblocks of mermaid diagrams are replaced with rendered SVGs.

Usage

The plugin is installed as any other remark plugin, see unified's plugin documentation.

Diagrams are written as codeblocks with the "mermaid" language.

```mermaid
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```

Options

The options are not the same as the mermaid options. The options have been tweaked to be easier to specify. Options can always be overwritten with raw mermaid options by using the __mermaid and __mermaid.__darkMode options.

security

security?: 'strict' | 'loose' | 'antiscript' | 'sandbox' = 'strict'

Same as the mermaid option securityLevel. Serves as an option for the level of trust for the parsed diagram.

  • 'strict': tags in text are encoded, script functionality is disabled.
  • 'loose': tags in text are allowed, script functionality is enabled.
  • 'antiscript': html tags in text are allowed, only script elements are removed, script functionality is enabled.

theme

theme?: string | ThemeOptions = 'default'

theme

theme?: string = 'default'

customCss

customCss?: string

variables

variables?: unknown

renderDark

renderDark?: DarkOptions | boolean = false

Enables the additional rendering of dark mode. This will require you to define css rules for displaying the images. Rendered svgs will always (even if you have renderDark disabled) have either the classes mermaid, and mermaid__light or mermaid__dark.

.mermaid.mermaid__light { display: initial; }
.mermaid.mermaid__dark { display: none; }

@media (prefers-color-scheme: dark) {
  .mermaid.mermaid__light { display: none; }
  .mermaid.mermaid__dark { display: initial; }
}

logLevel

logLevel?: LogLevel = LogLevel.Error

flowchart

flowchart?: FlowchartDiagramOptions

Options for flowchart diagrams.

sequence

sequence?: SequenceDiagramOptions

Options for sequence diagrams.

gantt

gantt?: GanttDiagramOptions

Options for gantt diagrams.

journey

journey?: JourneyDiagramOptions

Options for journey diagrams.

pie

pie?: PieChartOptions

Options for pie diagrams.

requirement

requirement?: RequirementDiagramOptions

Options for requirement diagrams.

er

er?: ErDiagramOptions

Options for er diagrams.

git

git?: GitGraphOptions

Options for git diagrams.

state

state?: StateDiagramOptions

Options for state diagrams.

freeze

freeze?: (keyof Options)[]

Keys in options to freeze. Same as the mermaid option secure.

style

style?: StyleOptions

fontFamily

fontFamily?: string

maxTextSize

maxTextSize?: number