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

@venzee/githubify

v1.2.0

Published

Convert Markdown files to Github compatible ones. Currently supports Mermaid-Diagram-to-SVG conversion

Downloads

8

Readme

githubify

At Venzee, we use this utility to help us write create documentation stored in our GitHub repositories. It enables us to use Markdown libraries currently not supported by GitHub.

At time of writing, the library supports offers conversion of Mermaid to SVG files, which GitHub can render.

Installation

npm i -D @venzee/githubify

Commandline Usage

githubify src dist
  • src: the source directory to scan
  • dist: the output directory

API

import githubify from '@venzee/githubify'

githubify( src, dist, callback );
  • src: the source directory to scan
  • dist: the output directory
  • callback: NodeJs style callback
    • err: raised if an error occcurs while processing
    • outputPaths: The paths of the files generated by the function

Behaviour

Mermaid

Example 1: SimpleDiagram

src/SimpleDiagram.md

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

dist/SimpleDiagram

githubify will generate an image, replacing the Mermaid code block with a link to that image. By default, githubify will use a UUID for the file.

![alt media/SimpleDiagram/59c6b5e204db4ad6a637dd8791d9c8e2.svg](media/SimpleDiagram/59c6b5e204db4ad6a637dd8791d9c8e2.svg)

Folder structure after parsing SimpleDiagram

├── dist
│   ├── SimpleDiagram.md
│   └── media
│       └── SimpleDiagram
│           └── 59c6b5e204db4ad6a637dd8791d9c8e2.svg
└── src
    └── SimpleDiagram.md

Example 2: NamedDiagram

src/NamedDiagram


 # LastHeaderBeforeDiagramBecomesFilename

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

dist/NamedDiagram

![alt media/NamedDiagram/LastHeaderBeforeDiagramBecomesFilename.svg](media/NamedDiagram/LastHeaderBeforeDiagramBecomesFilename.svg)

Example 3: ManyEmbeddedDiagrams

src/ManyEmbeddedDiagrams

 # Many Embedded Diagrams

 Of course, you can comnine many diagrams with any type of text. Just keep
 in mind that the last title before the digram will be removed in the generated
 output and used as the title of the diagram below.

 # 1stDiagram

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

 Once defined, you can refer to the same diagram again by name, even in the source:

 ![alt A Markdown Image link to the diagram defined above](media/ManyEmbeddedDiagrams/1stDiagram.svg)

 And of course, you can declare anonymous diagrams embedded as well:

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

 For identical diagrams, _githubify_ will generate only 1 image. The diagram below
 is a copy of the diagram above:

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

 And if one of the duplicate instances was named, `githubify` will use that diagram's name.
 The below is an exact copy of _1stDiagram_ above:

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

 Lastly, if you have multiple identical diagrams with different names, multiple
 images will be rendered:

# SameAs1stDiagramButDifferentTitle

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

dist/ManyEmbeddedDiagrams

 # Many Embedded Diagrams

 Of course, you can comnine many diagrams with any type of text. Just keep
 in mind that the last title before the digram will be removed in the generated
 output and used as the title of the diagram below.

 ![alt media/ManyEmbeddedDiagrams/1stDiagram.svg](media/ManyEmbeddedDiagrams/1stDiagram.svg)

 Once defined, you can refer to the same diagram again by name, even in the source:

 ![alt A Markdown Image link to the diagram defined above](media/ManyEmbeddedDiagrams/1stDiagram.svg)

 And of course, you can declare anonymous diagrams embedded as well:

 ![alt media/ManyEmbeddedDiagrams/e94d56a7f2964e11acbb367a1f5d412d.svg](media/ManyEmbeddedDiagrams/e94d56a7f2964e11acbb367a1f5d412d.svg)

 For identical diagrams, _githubify_ will generate only 1 image. The diagram below
 is a copy of the diagram above:

 ![alt media/ManyEmbeddedDiagrams/e94d56a7f2964e11acbb367a1f5d412d.svg](media/ManyEmbeddedDiagrams/e94d56a7f2964e11acbb367a1f5d412d.svg)

 And if one of the duplicate instances was named, it will use that diagram's name.
 The below is an exact copy of _1stDiagram_ above:

 ![alt media/ManyEmbeddedDiagrams/1stDiagram.svg](media/ManyEmbeddedDiagrams/1stDiagram.svg)

 Lastly, if you have multiple identical diagrams with different names, multiple
 images will be rendered:

 ![alt media/ManyEmbeddedDiagrams/SameAs1stDiagramButDifferentTitle.svg](media/ManyEmbeddedDiagrams/SameAs1stDiagramButDifferentTitle.svg)

Folder structure after parsing ManyEmbeddedDiagrams

├── dist
│   ├── ManyEmbeddedDiagrams.md
│   └── media
│       └── ManyEmbeddedDiagrams
│           ├── 1stDiagram.svg
│           ├── e94d56a7f2964e11acbb367a1f5d412d.svg
│           └── SameAs1stDiagramButDifferentTitle.svg
└── src
    └── ManyEmbeddedDiagrams.md