htmldoc-ext

1.0.2 • Public • Published

htmldoc-ext

npm version Build Status Maintainability License: MIT

Usage

Extract annotation content.
You are free to specify the annotation.

const htmldoc = require('htmldoc-ext')
 
 
const filepath = './index.html'
<!--
  @description descriptiondescription
           description
           descriptiondescription
  @testtest notenotenote
  @date 2018/08/26
  @url
    - https://111.com
    - https://222.com
    - https://333.com
  @name index.html
  @list ・1111111  ・2222222  ・3333333
-->
 
<!DOCTYPE html>
<html>
<head>
  <title>./index.html</title>
</head>
<body>
 
</body>
</html>

Single item

let test = htmldoc.content(filepath, 'testtest')
// -> notenotenote
 
let description = htmldoc.content(filepath, 'description')
// -> descriptiondescription\ndescription\ndescriptiondescription
 
let date = htmldoc.content(filepath, 'date')
// -> 2018/08/26

Multiple items

let url = htmldoc.list(filepath, 'url')
// -> ["https://111.com", "https://222.com", "https://333.com"]
 
let list = htmldoc.list(filepath, 'list', '')
// -> ["1111111", "2222222", "3333333"]

Convert to Preferred list style

let array = ["1111111", "2222222", "3333333"]
 
let circleList = htmldoc.itemize(array)
// -> "・1111111\n・2222222\n・3333333"
 
let arrowList = htmldoc.itemize(array, '')
// -> "> 1111111\n> 2222222\n> 3333333"

License

The MIT License.

/htmldoc-ext/

    Package Sidebar

    Install

    npm i htmldoc-ext

    Weekly Downloads

    6

    Version

    1.0.2

    License

    MIT

    Unpacked Size

    13.3 kB

    Total Files

    8

    Last publish

    Collaborators

    • pprhr