hexo-post-parser v3.0.1
hexo-post-parser
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
Shortcode | Description |
---|---|
<!-- 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
8 months ago
8 months ago
8 months ago
8 months ago
8 months ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago