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

@kazumatu981/markdown-it-kroki

v1.3.2

Published

markdown-it kroki plugin.

Downloads

37

Readme

markdown-it-kroki

This library was designed to embed Kroki.io diagram into Marp slide decks!!

This library is a plugin for markdown-it to embed figure created by textual syntax. To use this package, you can embed Software Diagram (like UML) written by code in Marp slide decks.

See marp sample code.

Sample

---
marp: true
---


## plantuml

```plantuml[platuml image]
@startuml
left to right direction
actor Guest as g
package Professional {
actor Chef as c
actor "Food Critic" as fc
}
package Restaurant {
usecase "Eat Food" as UC1
usecase "Pay for Food" as UC2
usecase "Drink" as UC3
usecase "Review" as UC4
}
fc --> UC4
g --> UC1
g --> UC2
g --> UC3
@enduml
```

plantuml-sample

If you want to write diagrams, you can use various syntaxes (such as PlantUML or Mermaid) within fenced code blocks.

How to install

You can install npm install command like below.

npm install -D @kazumatu981/markdown-it-kroki

How to use

Here is the how to use markdow-it-kroki. This section introduces how to create Marp slides deck project, and introduces how to create Marp slides deck server.

You can find detail here, and you can learn about marp plugin ecosystem here.

[1st step] Create slides deck project

First, to create a slides deck, you have to create a Marp Project directory and initialize a npm project.

mkdir myslides
cd myslides
npm init -y

Then, build a Marp environment. Install @marp-team/marp-cli.

npm install -D @marp-team/marp-cli

Off-course you can install as global package (like npm install -g @marp-team/marp-cli), or run at-once (like npx).

[2nd step] Download this project and install

git clone https://github.com/kazumatu981/markdown-it-kroki.git

cd myslides
npm install -D path/to/markdown-it-kroki

[3rd step] Create marp.config.js.

Here is the configuration file for Marp.

module.exports = {
    inputDir: './slides',
    engine: ({ marp }) => marp.use(require('@kazumatu981/markdown-it-kroki'), {
        entrypoint: "https://kroki.io",
    })
}

[4th step] Create your slides

On slies directory. you create slides-deck. like this.

---
marp: true
---


## mermaid

```mermaid[mermaid image]
flowchart TD
    Start --> Stop
```

[5th step] run server

Run marp server.

marp -s -c marp.config.js

Detail

Syntax of Markdown

Diagram Language

You have to write diagram language by fenced code block syntax, start with triple back quot and after that the language.

```plantuml

[!NOTE]
This package depends on Kroki.io.
If you want to know which diagram languages are supported, please check the official website at https://kroki.io/.

Alt Text

You can write Alt-text attribute to IMG tag in HTML. Write in square blacket after Diagram Language.

```mermaid [check your network config..]

Options of constructor

| property-name | type | mean | defaul value | | ---------------- | -------- | ------------------------------------------------------ | ------------------------- | | entrypoint | string | The entry point for Kroki server. | 'https://kroki.io' | | containerClass | string | class name of container (DIV-tag class attribute). | 'kroki-image-container' | | imageFormat | string | image format of diagram. see here | 'svg' | | useImg | boolean | use <img> tag for embed diagram. ( for compatibility for past version ) | false | | render | function | if you render html yourself use this option. see How To Write render() call back | undefined |