open-index/open-npm huggingface dataset:
npm package: @honkit/markdown-legacy
Description: Parse markdown content for HonKit
Author: HonKit
Latest version: 6.1.7

# Honkit Legacy Markdown Parser

**This module is maintenance mode**

This node module uses kramed to parse markdown for gitbook (SUMMARY.md, README.md).

It will compatible GitBook v3 Markdown parser.
It is a fork of [gitbook-markdown@1.3.2](https://github.com/GitbookIO/gitbook-markdown).

For more details, see <https://github.com/honkit/honkit/issues/77#issuecomment-653592952>

## License

Apache License, Version 2.0

It includes [gitbook-markdown@1.3.2](https://github.com/GitbookIO/gitbook-markdown) works.
npm package: @honkit/markup-it
Description: Pipeline for working with markup input (for example Markdown)
Author: azu
Latest version: 6.1.7

# @honkit/markup-it

`@honkit/markup-it` is a JavaScript library to parse and modify markuped content (for example Markdown) using an intermediate format backed by an immutable model.

`@honkit/markup-it` is fork of [markup-it](https://github.com/GitbookIO/markup-it)@2.2.0

- Less dependency
- For stability

### Installation

```
$ npm i @honkit/markup-it  --save
```

### Usage

Initialize a syntax:

```js
var MarkupIt = require('@honkit/markup-it');
var markdownSyntax = require('@honkit/markup-it/syntaxes/markdown');
var htmlSyntax = require('@honkit/markup-it/syntaxes/html');

var markdown = new MarkupIt(markdownSyntax);
var html = new MarkupIt(htmlSyntax);
```

#### Parse a text

```js
var content = markdown.toContent('Hello **World**');
```

#### Render content to HTML/Markdown

```js
// Render back to markdown:
var textMd = markdown.toText(content);

// Render to HTML
var textHtml = html.toText(content);
```

#### Convert HTML into Markdown

```js
var content = html.toContent('Hello <b>World</b>');
var textMd = markdown.toText(content);
```

### Extend Syntax

This module contains the [markdown syntax](./syntaxes/markdown), but you can write your custom syntax or extend the existing ones.

#### Create rules

```js
var myRule = MarkupIt.Rule(DraftMarkup.BLOCKS.HEADING_1)
    .regExp(/^<h1>(\S+)<\/h1>/, function(state, match) {
        return {
            tokens: state.parseAsInline(match[1])
        };
    })
    .toText(function(state, token) {
        return '<h1>' + state.renderAsInline(token) + '</h1>';
    });
```

#### Custom Syntax

Create a new syntax inherited from the markdown one:

```js
var mySyntax = markdownSyntax.addBlockRules(myRule);
```

## License

Apache-2.0

It includes Samy Pesse and GitBook works.

- Samy Pesse <samy@gitbook.com> - [markup-it](https://github.com/GitbookIO/markup-it)
npm package: @honkjs/components
Description: Component middleware for honk.
Latest version: 1.0.2

# honkjs/components [![npm-img]][npm-link] [![dep-img]][dep-link] [![dev-img]][dev-link]

[npm-img]: https://img.shields.io/npm/v/@honkjs/components.svg?style=flat-square 'npm version'
[npm-link]: https://www.npmjs.com/package/@honkjs/components
[dep-img]: https://david-dm.org/honkjs/components.svg?style=flat-square 'dependency status'
[dep-link]: https://david-dm.org/honkjs/components
[dev-img]: https://david-dm.org/honkjs/components/dev-status.svg?style=flat-square 'dev dependency status'
[dev-link]: https://david-dm.org/honkjs/components?type=dev

A honk middleware for creating and caching choo [nanocomponents](https://github.com/choojs/nanocomponent).

This is probably the most opinionated of the basic honk middlewares.

# Basics

First, the component:

```ts
import { IHonkServices } from '@honkjs/honk';
import { createHonkComponent } from '@honkjs/components';
import html from 'choo/html';
import Component from 'choo/component';

type HelloComponentProps = { id: string; name: string };

class HelloComponent extends Component {
  private prev?: string;

  createElement({ name }: HelloComponentProps) {
    this.prev = name;
    return html`<div>Hello, ${name}</div>`;
  }

  update({ name }: HelloComponentProps) {
    return this.prev !== name;
  }
}

const create = createHonkComponent('Hello', (services: IHonkServices, id: string, props: HelloComponentProps) => {
  return new HelloComponent();
});

export default create;
```

And how we use it:

```ts
import Honk from '@honkjs/honk';
import components from '@honkjs/components';
import hello from './HelloComponent';

const honk = new Honk().use(components()).honk;

honk(create, { id: 'yo', name: 'bob' });
// returns:  html`<div>Hello, bob</div>`
```

The component itself is defined like normal. Honk only requires all the props to be passed as a single object.

To make a component instantiable via honk, it has to be wrapped by `createHonkComponent`. This creates a function that can be called to create or uncache the component as appropriate.

```ts
/**
 * The first argument is the name of the component.
 * This is prefixed to the id when when working to the cache.
 *
 * The second argument is the function to create a new instance of the component.
 * It's passed the honk services, the id (with prefix), and the initializing props.
 */
const create = createHonkComponent('Hello', (services: IHonkServices, id: string, props: HelloComponentProps) => {
  return new HelloComponent();
});
```

## ID from props

By default, the props must contain an "id" field used to locate the component. Alternatively, you can define a function to map the id from the passed property object.

For example:

```ts
function getIdFromProps(item: Item) {
  return item.id;
}

function createComponent(services: IHonkServices, id: string, props: Item) {
  return new ItemComponent();
}

const create = createHonkComponent('ItemView', createComponent, getIdFromProps);
```

# Using with choo

[still in transit 🚚]
npm package: @honkjs/publisher
Description: A simple event publisher with subscriptions.
Author: Kellen Piffner
Latest version: 0.1.1

<div>
  <!-- npm -->
  <a href="https://www.npmjs.com/package/@honkjs/publisher">
    <img src="https://img.shields.io/npm/v/@honkjs/publisher.svg?style=flat-square" alt="npm version" />
  </a>
  <!--  dependencies -->
  <a href="https://david-dm.org/honkjs/publisher">
    <img src="https://david-dm.org/honkjs/publisher.svg?style=flat-square" alt="dependency status" />
  </a>
  <!-- dev dependencies  -->
  <a href="https://david-dm.org/honkjs/publisher&type=dev">
    <img src="https://david-dm.org/honkjs/publisher/dev-status.svg?style=flat-square" alt="dev dependency status" />
  </a>
  <!-- coverage -->
  <a href="https://codecov.io/github/honkjs/publisher">
    <img src="https://img.shields.io/codecov/c/github/honkjs/publisher/master.svg?style=flat-square" alt="test coverage" />
  </a>
  <!-- build -->
  <a href="https://travis-ci.org/honkjs/publisher">
    <img src="https://img.shields.io/travis/honkjs/publisher/master.svg?style=flat-square" alt="build status" />
  </a>
</div>

# honkjs/publisher

Single event type publisher. Allows for type safe custom arguments publishing.

# Example

```ts
import { Publisher } from '@honkjs/publisher';

// the type of function can be anything that returns void or boolean.
// any other params are allowed.
type MyEvent = (a: string, b: number) => void;

const event = new Publisher<MyEvent>();

const unsub = event.subscribe((a, b) => {
  console.log('published', a, b);
});

event.publish('hello', 5); // output: published, hello, 5

unsub();

event.publish('hello?', 0); // output: nothing
```

# Creating a store

Let's build out a store that generates events when the state is changed.

```ts
import { Publisher } from '@honkjs/publisher';

export function createStore<S>(initialState: S) {
  let state = initialState;
  let events = new Publisher<(state: S) => void>();

  return {
    setState: (action) => {
      state = action(state);
      events.publish(state);
    },
    getState: () => state,
    subscribe: (listener) => events.subscribe(listener),
  };
}

const state = { data: 'test' };

const store = createStore(state);

const unsub = store.subscribe((s) => {
  console.log('updated', s);
});

store.setState({ data: 'different' });
// outputs: updated, { data: different }

unsub();
```

This functionality is built for you in [@honkjs/store.](https://github.com/honkjs/store)
npm package: @honkjs/silence
Description: A silent/example middleware for honk.
Author: Kellen Piffner
Latest version: 3.0.0

<div>
  <!-- npm -->
  <a href="https://www.npmjs.com/package/@honkjs/silence">
    <img src="https://img.shields.io/npm/v/@honkjs/silence.svg?style=flat-square" alt="npm version" />
  </a>
  <!--  dependencies -->
  <a href="https://david-dm.org/honkjs/silence">
    <img src="https://david-dm.org/honkjs/silence.svg?style=flat-square" alt="dependency status" />
  </a>
  <!-- dev dependencies  -->
  <a href="https://david-dm.org/honkjs/silence&type=dev">
    <img src="https://david-dm.org/honkjs/silence/dev-status.svg?style=flat-square" alt="dev dependency status" />
  </a>
  <!-- coverage -->
  <a href="https://codecov.io/github/honkjs/silence">
    <img src="https://img.shields.io/codecov/c/github/honkjs/silence/master.svg?style=flat-square" alt="test coverage" />
  </a>
  <!-- build -->
  <a href="https://travis-ci.org/honkjs/silence">
    <img src="https://img.shields.io/travis/honkjs/silence/master.svg?style=flat-square" alt="build status" />
  </a>
</div>

# honkjs/silence

[![Greenkeeper badge](https://badges.greenkeeper.io/honkjs/silence.svg)](https://greenkeeper.io/)

Because you hate honking.

# Getting Started

```
npm install @honkjs/silence
```

```ts
import Honk from '@honkjs/honk';
import silence from '@honkjs/silence';

const honk = new Honk().use(silence()).honk;

honk(); // output: Nothing
```

# Concepts

This repo can be used as quick example of how to build a 'catch all' middleware. Chances are in a production app you don't want missed dispatches to randomly output "HONK 🚚 HONK" to the console, so you should create a new 'default' middleware that's first in the pipeline to catch these with whatever default behavior you want.
npm package: @honkjs/store
Description: A simple state store with subscriptions.
Author: Kel Piffner
Latest version: 1.0.6

<div>
  <!-- npm -->
  <a href="https://www.npmjs.com/package/@honkjs/store">
    <img src="https://img.shields.io/npm/v/@honkjs/store.svg?style=flat-square" alt="npm version" />
  </a>
  <!-- coverage -->
  <a href="https://codecov.io/github/honkjs/store">
    <img src="https://img.shields.io/codecov/c/github/honkjs/store/master.svg?style=flat-square" alt="test coverage" />
  </a>
</div>

# honkjs/store

A very simple state store with update subscriptions. For when [redux](https://redux.js.org/) is just a little too much.

Store doesn't have any dependencies on honk, and can be used more as a utility library.

# Example

```ts
import { createStore } from '@honkjs/store';

const initState = {
  count: 0,
};

const store = createStore(initState);

const unsubscribe = store.subscribe((state) => {
  console.log('updated', state);
});

// state can be updated using immutable patterns.
store.setState((state) => {
  return {
    ...state,
    count: 1,
  };
});
// output: 'updated', { count: 1 }

// or alternatively, mutated directly.
store.setState((state) => {
  state.count = 100;
  return state;
});
// output: 'updated', { count: 100 }

// use getState to retrieve the current value.
const count = store.getState().count;

// call the unsubscribe function to stop listening.
// any mutations after this will be ignored.
unsubscribe();
```

# Using with nanocomponents

Store doesn't currently have the equivalent of a 'redux-connect' helper, but it can be wired up manually to a component quite simply.

Here is an example of a choo component that will re-render when the store changes.

```ts
import html from 'nanohtml';
import Component from 'nanocomponent';
import { IHonkStore, IUnsubscribe } from '@honkjs/store';

type MyState = { count: number };

export class CountContainer extends Component {
  private unsub?: IUnsubscribe;
  private count: number;

  constructor(public id: string, private store: IHonkStore<MyState>) {
    super(id);
    this.count = store.getState().count;
  }

  createElement() {
    return html`<span>Count: ${this.count}</span>`;
  }

  update() {
    return false;
  }

  load() {
    this.unsub = this.store.subscribe((state) => {
      this.count = state.count;
      this.rerender();
    });
  }

  unload() {
    this.unsub && this.unsub();
  }
}
```