1.0.4 • Published 6 years ago

doc-head-extract v1.0.4

Weekly downloads
6
License
ISC
Repository
github
Last release
6 years ago

doc-head-extract

extract headings from html string.

input

<h2 id="foo">foo</h2>
<p> p... </p>
<h3> bar </h3>
<h2 id="rah">rah <div>...</div> </h2>

will get

[
  {
    anchor: "foo",
    name: "foo",
    depth: 2,
    sub: [
      {
        anchor: undefined,
        name: "bar",
        depth: 3,
        sub: []
      }
    ]
  },
  {
    anchor: "rah",
    name: "rah ...",
    depth: 2,
    sub: []
  }
]

install

npm i doc-head-extract -S

usage

import extractHead from 'doc-head-extract'

extractHead('<p> html string... </p>')
1.0.4

6 years ago

1.0.3

6 years ago

1.0.2

6 years ago

1.0.1

6 years ago

1.0.0

6 years ago