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

kunst-cli

v1.0.3

Published

Markdown to markdown transformer, using remark. Handles directories.

Downloads

4

Readme

Kunst CLI

NPM Travis CI MIT License

It was in Strasbourg in 1440 that Johannes Gutenberg is said to have perfected and unveiled the secret of printing based on his research, mysteriously entitled Aventur und Kunst (enterprise and art).

Kunst CLI (the new printing press) is a Markdown transformer which is able to process a directory of files, apply relevant transformations or checks to Markdown files, and then save them in a destination directory.

It uses remark internally, and remark plugins can be specified using a kunst.config.json or kunst.config.js file.

Installation

Install Kunst CLI globally for ease of use with the following command:

npm install -g kunst-cli

Using Kunst CLI

The Kunst CLI exposes a single command, kunst that has several options:

  • --source A directory of source Markdown to transform. Defaults to the current directory.
  • --target The directory where the transform source will be added. Defaults to /target.
  • --config Allows remark to be configured at runtime. Accepts a path to a JSON file. When omitted, Kunst looks for the config file kunst.config.json on the same directory that it runs from. See config file.
  • --clean If provided, the target directory will be emptied before transforming.
  • --watch If provided, kunst will watch for changes in the --source path and transform files from --source path to --target path.

Config file

Kunst config files describe a remark preset, as js or json. If the config file is a json file, Kunst will dynamically load all the specified remark plugins and construct a preset.

All remark plugins specified in the config file must be added as NPM dependencies in your project.

Example of kunst.config.json:

{
  "plugins": [
    "remark-comment-config",
    "remark-graphviz",
    "remark-openapi",
    [
      "remark-gitlab-artifact",
      {
        "apiBase": "https://gitlab.com",
        "gitlabApiToken": "${GITLAB_API_TOKEN}"
      }
    ]
  ]
}

In the above example, Kunst can replace environment variables in the config file, e.g. GITLAB_API_TOKEN, and with the actual value if the environment variable exists, before executing remark transformations.

Example of kunst.config.js:

const commentConfig = require('remark-comment-config');
const graphviz = require('remark-graphviz');
const openapi = require('remark-openapi');
const gitlab = require('remark-gitlab-artifact');

module.exports = {
  plugins: [
    commentConfig,
    graphviz,
    openapi,
    [
      gitlab,
      {
        apiBase: 'https://gitlab.com',
        gitlabApiToken: process.env.GITLAB_API_TOKEN,
      }
    ],
  ],
};

Examples

The following will process the directory test/fixtures/full and output the result to test/fixtures/runtime:

$ kunst --source test/fixtures/full --target test/fixtures/runtime --config kunst.config.js
info:    Kunst transformation complete. durationMs=2932
info:    /Users/brendanabbott/Sites/kunst-cli/test/fixtures/full/index.md
      63:1-94:4  info  dot code block replaced with graph    remark-graphviz
  101:19-101:62  info  dot link replaced with link to graph  remark-graphviz

/Users/brendanabbott/Sites/kunst-cli/test/fixtures/full/nested/index.md
       5:1-5:47  info  dot link replaced with link to graph  remark-graphviz

--watch allows you to re-run transforms as you make changes to files in the --source directory. You can stop watching by terminating the command.

$ kunst --source test/fixtures/full --target test/fixtures/runtime --config kunst.config.js --watch
info:    watching test/fixtures/full for any changes to .md files…
info:    detected change in test/fixtures/full/nested/index.md…
info:    Kunst transformation complete. durationMs=1714
info:    test/fixtures/full/nested/index.md
  5:1-5:47  info  dot link replaced with link to graph  remark-graphviz

Credit

Kunst is a rather small veneer over the excellent remark ecosystem. Full credit to @wooorm and everyone who has contributed to make that ecosystem brilliant.

Why?

At Temando developers write documentation alongside the source code and store it in the same project. We've developed our own Markdown flavour to help developers use files in project in documentation. For example, dependency files are parsed to add a "Dependencies" list into README.md files.

To facilitate this, we often reuse existing Markdown functionality, notably the Link title, to act as a hook for remark plugins. This progressive enhancement allows the Markdown to be readable in other contexts (eg. Gitlab UI) before it's published to our internal site. It also means we can offload the responsibility of transforming Markdown to HTML to other tools.

Where it has made sense to do so, our remark plugins are available on Github/NPM:

  • remark-graphviz — Replace dot graphs with rendered SVGs
  • remark-gitlab-artifact — Download artifacts from GitLab projects to live alongside your Markdown
  • remark-openapi — Convert links to local or remote OpenAPI definition to tables with summaries of all paths

Maintainers

Kunst is an open source project from Temando's Developer Experience team. Temando connects carriers with retailers and retailers to people. The Temando Platform combines shipping experiences, multi-carrier connectivity and lightning fast fulfillment in one solution. If this sounds like fun, work with us!