项目作者: snowyu

项目描述 :
Process html to a specified format document(markdown currently), build-in Joplin Web Clipper Server for Joplin Web Clipper
高级语言: TypeScript
项目地址: git://github.com/snowyu/h2doc.js.git
创建时间: 2020-07-08T14:42:51Z
项目社区:https://github.com/snowyu/h2doc.js

开源协议:

下载


h2doc

Process html to a specified format document(markdown currently), build-in Joplin Web Clipper Server for Joplin Web Clipper or Web-clipper

oclif
Version
Downloads/week
License

Features

  • Convert html to markdown format
  • Download pictures in the html
  • Directory is a notebook
  • Collect and cache the tags from the front-matter of markdown
    • Use the special tag format on the first tag to create folder through prefix / or ./
      • startsWith / means absolute path which relative to the root directory
      • startsWith ./ means relative path of the folder
  • Save markdown and pictures to the current(specified) folder(root)
  • decides the rules for stored file name and dir name:
    1. markdown file with the same markdown name folder
      • markdown file: ${folder}/${title}.md
      • markdown assets folder: ${folder}/${title}/
      • markdown assets base file name: ${assetBaseName}
    2. markdown name folder, index(README).md as markdown name in folder
      • markdown file: ${folder}/${title}/index.md
      • markdown assets folder: ${folder}/${title}/
      • markdown assets base file name: ${assetBaseName}
    • you can customize by yourself

Supported variables and functions:

  • folder: the relative to root directory (coming from Joplin Web Clipper)
  • title: (come from Joplin Web Clipper)
  • assetBaseName: the name should not include the extname.
  • date: the ISO format date time.
  • index: the index number of asset.
  • slug : the smart slug of the title.
  • shortid(): return the short unique id.
  • toSlug(str): convert the str to a smart slug.

Usage

  1. $ npm install -g h2doc
  2. $ h2doc COMMAND
  3. running command...
  4. $ h2doc (-v|--version|version)
  5. h2doc/0.0.0-development linux-x64 node-v12.18.4
  6. $ h2doc --help [COMMAND]
  7. USAGE
  8. $ h2doc COMMAND
  9. ...

Configuration

The config file name could be .md-config.(yaml|json) or md-config.(yaml|json).

The config file search order:

  1. the current working(root) directory
  2. the user home directory
  3. the application config directory
  1. # .md-config.yaml
  2. output:
  3. root: . # the root folder, defaults to current working directory.
  4. exclude: # do not include these folders:
  5. - node_modules
  6. deep: 5 # Specifies the maximum depth of a read directory relative to the root.
  7. markdown: ${folder}/${title}.md # whether use the smart slug as markdown file name
  8. asset: ${folder}/${title}/
  9. assetBaseName: ${assetBaseName} # do not include extname
  10. slug: # the smart slug options, if it is string which means separator
  11. separator: '-' # String to replace whitespace with, defaults to -
  12. lang: '' # ISO 639-1 two-letter language code, defaults to auto-detected language
  13. tone: false # add tone numbers to Pinyin transliteration of Chinese, defaults to true
  14. separateNumbers: false # separate numbers that are within a word, defaults to false
  15. maintainCase: false # maintain the original string's casing, defaults to false
  16. download: true # whether download assets
  17. format: # WARNING: these options maybe changed in the future
  18. headingStyle: 'atx' # setext or atx
  19. hr: '---'
  20. bulletListMarker: '*'
  21. codeBlockStyle: 'fenced' # indented or fenced
  22. fence: '```' # ``` or ~~~
  23. emDelimiter: '_' # _ or *
  24. strongDelimiter: '**' # ** or __
  25. linkStyle: 'inlined' # inlined or referenced
  26. linkReferenceStyle: 'full' # full, collapsed, or shortcut
  27. gfm:
  28. strikethrough: true # for converting <strike>, <s>, and <del> elements
  29. tables: true
  30. taskListItems: true
  31. frontMatter: # whether use front matter(insert into markdown).
  32. title: true
  33. url: true
  34. author: true
  35. date: true
  36. publisher: true
  37. lang: true
  38. description: true
  39. image: true
  40. video: true
  41. audio: true

Commands

h2doc autocomplete [SHELL]

display autocomplete installation instructions

  1. USAGE
  2. $ h2doc autocomplete [SHELL]
  3. ARGUMENTS
  4. SHELL shell type
  5. OPTIONS
  6. -r, --refresh-cache Refresh cache (ignores displaying instructions)
  7. EXAMPLES
  8. $ h2doc autocomplete
  9. $ h2doc autocomplete bash
  10. $ h2doc autocomplete zsh
  11. $ h2doc autocomplete --refresh-cache

See code: @oclif/plugin-autocomplete

h2doc help [COMMAND]

display help for h2doc

  1. USAGE
  2. $ h2doc help [COMMAND]
  3. ARGUMENTS
  4. COMMAND command to show help for
  5. OPTIONS
  6. --all see all commands in CLI

See code: @oclif/plugin-help

h2doc server [DIR]

The Joplin Web Clipper Server to save markdown and images

  1. USAGE
  2. $ h2doc server [DIR]
  3. ARGUMENTS
  4. DIR which folder to save
  5. OPTIONS
  6. -h, --help show CLI help
  7. -h, --host=host [default: localhost] the host to serve
  8. -p, --port=port [default: 41184] the port to serve
  9. -t, --timeout=timeout [default: 15000] the timeout to serve
  10. DESCRIPTION
  11. ALIASES
  12. $ h2doc default
  13. $ h2doc srv
  14. $ h2doc svr
  15. $ h2doc serv

See code: src/oclif/commands/server.ts

h2doc tags [FOLDER]

collect all tags from the front-matter in the folder and save to file

  1. USAGE
  2. $ h2doc tags [FOLDER]
  3. ARGUMENTS
  4. FOLDER the folder to collect tags, defaults to the current directory
  5. OPTIONS
  6. -c, --cache=cache [default: .md-tags.yaml] cache all the tags in the folder to the file
  7. -h, --help show CLI help
  8. -s, --skip skip the cache file
  9. -t, --format=yaml|json [default: yaml] the display tags format
  10. -w, --write write to the cache file
  11. -x, --extended show extra columns
  12. --columns=columns only show provided columns (comma-separated)
  13. --csv output is csv format [alias: --output=csv]
  14. --filter=filter filter property by partial string matching, ex: name=foo
  15. --no-header hide table header from output
  16. --no-truncate do not truncate output to fit screen
  17. --output=csv|json|yaml output in a more machine friendly format
  18. --sort=sort property to sort by (prepend '-' for descending)

See code: src/oclif/commands/tags.ts