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

@storybook-extras/markdown

v0.0.68

Published

Storybook addon for auto importing markdown docs.

Downloads

229

Readme

Getting started

  1. Install the addon:
yarn add @storybook-extras/markdown -D
  1. Add the addon to your Storybook config:
// .storybook/main.ts
import { StorybookConfig } from '@storybook/angular';
import { ExtrasConfig } from '@storybook-extras/preset';

const config: StorybookConfig & ExtrasConfig = {
    ...
    "stories": [
        "../*.@(md|html)",
        "../src/**/*.stories.@(js|jsx|ts|tsx)"
    ],
    "addons": [
        "@storybook-extras/markdown",
        ...
    ],
    ...
}

export default config;
  1. Optionally you may want to pass includes and/or excludes options if needed like so:
export default {
    addons: [
        {
            name: '@storybook-extras/markdown',
            options: {
                includes: '../stories/**/*.@(md|html)',
                excludes: [/\.component\.html$/],
                stories: [
                    {
                        path: '../stories/markdown-main-js.md',
                        title: 'Markdown/main.js',
                    },
                ],
            },
        },
    ],
};

That's it, you're done. Now you will find README & CHANGELOG along with HTML docs if you want as well, in your Storybook sidebar and you can open them and see the contents.

Custom Titles

Currently Storybook will be using the file name as the story title, e.g. README.md will be README. This addon supports multiple options to customize the title for your .md & .html files.

| Precedence | Option | Example | | ---------- | ----------------------------------------------------------------------------------- | -------------------------------------------------------------- | | 1 | Use the HTML title tag | <title>Docs/Custom Title</title> | | 2 | Use the HTML meta tag, usign Meta will throw an error | <meta title="Custom Title" /> | | 3 | Uses a markdown comment in the file | {/*title:"Custom Title"*/} | | 4 | Use predefined list of titles from main.js | See below | | 5 | Use the filename with a + to separate the title. Note: full path will be omitted. | Markdown+Custom Title.md becomes Markdown/Custom Title |

Predefined Titles

// .storybook/main.ts
import { StorybookConfig } from '@storybook/angular';
import { ExtrasConfig } from '@storybook-extras/preset';

const config: StorybookConfig & ExtrasConfig = {
    // if you are using @storybook-extras/markdown
    addons: [
        {
            name: '@storybook-extras/markdown',
            options: {
                titles: {
                    '../README.md': 'Custom Title',
                },
            },
        },
    ],
    // if you are using @storybook-extras/preset
    extras: {
        markdown: {
            titles: {
                '../README.md': 'Custom Title',
            },
        },
    },
};

export default config;

NOTE: Custom Title processing is dependendant on #20809

Read More

I have written a series of articles to explain the motivation and purpose behind this addon. Feel free to read through.

Also make sure to check out these PRs that made this addon possible: