3.0.1 • Published 8 months ago

hexo-post-parser v3.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

hexo-post-parser

Build

Parse Hexo Posts To Object

Features

  • Parsing HexoJS markdown post
  • Parsing Jekyll markdown post
  • Post Asset Folder Auto Fix for HexoJS
  • Parse shortcodes - (Show all Shortcodes)
  • Include partials files with html comments
  • Get all images from post body and push them to metadata.photos
  • Auto find meta description when not set

Configuration needed

  • file _config.yml
generator:
  type: 'hexo' # or jekyll
  cache: true # enable caching
  verbose: false # enable verbose
  amp: false # transform shortcodes to amp html

parse post overriden options

const { parsePost } = require('hexo-post-parser');
parsePost('/path/to/file.md', {
shortcodes: {
  youtube: true,
  css: true,
  include: true,
  link: true,
  now: true,
  script: true,
  text: true,
  codeblock: true
},
config: {
  generator: {
    cache: false,
    verbose: false,
    amp: false,
    type: 'hexo'
  }
},
formatDate: true,
fix: true,
sourceFile: file.path
})

Shortcodes

ShortcodeDescription
<!-- include folder/path.txt -->Include partial files
<!-- script folder/script.js -->Include JS file as html script <script>codes</script>
{% youtube video_id %}transform youtube tag (AMP Supported)

Usage Sample

const fs = require('fs');
(async function(){
  const { parsePost, buildPost } = require('hexo-post-parser');
  const parse = await parsePost('path/to/markdown/file.md');
  // dump parsed post to json
  fs.writeFileSync('path/to/file.json', JSON.stringify(parse, null, 2));
  // build parsed post
  fs.writeFileSync('path/to/file.md', buildPost(parse));
})();

Project Sample

https://github.com/dimaslanjaka/static-blog-generator-hexo

https://github.com/dimaslanjaka/chimeraland

deployed to: www.webmanajemen.com

Argument Parameters

  • --nocache : disable cache
  • --verbose : show all console on verbose

Reference Repositories

3.0.1

8 months ago

2.0.2

8 months ago

2.0.1

8 months ago

2.0.0

8 months ago

3.0.0

8 months ago

1.2.14

1 year ago

1.2.12

2 years ago

1.2.11

2 years ago

1.2.10

2 years ago

1.2.8

2 years ago

1.2.7

2 years ago

1.2.9

2 years ago

1.2.6

2 years ago

1.2.5

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.0

2 years ago

1.1.9

3 years ago

1.1.8

3 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.1.12

3 years ago

1.1.11

3 years ago

1.1.10

3 years ago

1.1.16

3 years ago

1.1.15

3 years ago

1.1.14

3 years ago

1.1.13

3 years ago

1.1.19

3 years ago

1.1.18

3 years ago

1.1.17

3 years ago

1.1.22

2 years ago

1.1.21

2 years ago

1.1.20

3 years ago

1.1.7

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.1.1

3 years ago

1.1.0

3 years ago

1.0.11

3 years ago

1.0.10

3 years ago

1.0.9

3 years ago

1.0.8

3 years ago

1.0.7

3 years ago

1.0.6

3 years ago

1.0.5

3 years ago

1.0.4

3 years ago

1.0.3

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago