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

wm-md

v1.0.2

Published

代码生成 markdown 文件

Downloads

3

Readme

markdown code generate.

Install

npm install wm-md --save

Usage

const { Title, H1 } = require('wm-md');

const h1 = new H1('Hello World');
const title = new Title(h1);
console.log(title.toString()); // # Hello World\n\n

title.push('this is paragraph');
console.log(title.toString()); // # Hello World\n\nthis is paragraph\n\n

Componse

  • H1
const h1 = new H1('H1');
h1.toString(); // # H1\n\n
  • H2
const h2 = new H2('H2');
h2.toString(); // ## H2\n\n
  • H3
const h3 = new H3('H3');
h3.toString(); // ### H3\n\n
  • H4
const h4 = new H4('H4');
h4.toString(); // #### H4\n\n
  • H5
const h4 = new H5('H5');
h5.toString(); // ##### H5\n\n
  • Blockquotes
// single-line
const block1 = new Blockquotes('one');
block1.toString(); // > one\n\n

// mult-line
const block2 = new Blockquotes('one\ntwo');
block1.toString(); // > one\n> two\n\n
  • Bold
const bold = new Bold('bold');
bold.toString(); // **bold**
  • Code
const codeStr = 'console.log(\'hello world\')';
const codeType = 'js';
const code = new Code(codeStr, codeType);
code.toString();
// ```js
// console.log('hello world');
// ```
  • InlineCode
const inline = new InlineCode('console.log(\'Hello World\')');
inline.toString(); // `console.log('Hello World')`
  • Italic
const italic = new Italic('Italic');
italic.toString(); // *Italic*
  • Link
const url = 'http://www.google.com';
const site = 'Google';

// with name
const link1 = new Link(url, site);
link1.toString(); // [Google](http://www.google.com)

// without name
const link2 = new Link(url);
link1.toString(); // [](http://www.google.com)
  • OrderedList
const list = ['one', 'two', 'three'];
const order = new OrderedList(list);
order.toString();
// 1. one
// 2. two
// 3. three
//
//
  • UnorderedList
const list = ['one', 'two', 'three'];
const order = new UnorderedList(list);
order.toString();
// * one
// * two
// * three
//
//
  • Paragraph
const p1 = new P('paragraph');
p1.toString(); // paragraph\n\n

const p2 = new P('one\ntwo');
p2.toString(); // one two\n\n

const p3 = new P(['one', 'two']);
p3.toString(); // onetwo\n\n

const p4 = new P(['one', new Bold('two')]);
p4.toString(); // one**two**\n\n

const p5 = new P('one');
p5.joint('two');
p5.joint(new Bold('three'));
p5.toString(); // onetwo**three**\n\n
  • Span
const span = new Span('span');
span.toString() === 'span'; //true
  • Table
const list = [
    { a:1, b:2, c:3 },
    { a:4, b:5, d:6 }
];
const table = new Table(list);
table.toString();

| a | b | c | | ---- | ---- | ---- | | 1 | 2 | 3 | | 4 | 5 | |

const config = {
    a: 'nameA',
    b: 'nameB',
    c: 'nameC',
    d: 'nameD',
    e: 'nameE'
};
const table = new Table(list, config);
table.toString();

| nameA | nameB | nameC | nameD | nameE | | ----- | ----- | ----- | ----- | ----- | | 1 | 2 | 3 | | | | 4 | 5 | | 6 | |

const config = [
    { c: 'nameC' },
    { a: 'nameA' },
    { b: 'nameB' }
];
const table = new Table(list, config);
table.toString();

| nameC | nameA | nameB | | ----- | ----- | ----- | | 3 | 1 | 2 | | | 4 | 5 |

const list = [
    { a: 1, b: 2, c: 3 },
    { a: 4, b: 5, d: 6 }
];
const config = ['c', 'b', 'a'];
const table = new Table(list, config);
table.toString();

| c | b | a | | ---- | ---- | ---- | | 3 | 2 | 1 | | | 5 | 4 |

const list = [
    { a: new Bold(1), b: 2, c: 3 },
    { a: 4, b: 5, d: 6 }
];
const table = new Table(list);
table.toString();

| a | b | c | | ----- | ---- | ---- | | 1 | 2 | 3 | | 4 | 5 | |