Skip to content

A simple library to read / edit / write markdown files of hexo blog posts.

Notifications You must be signed in to change notification settings

kamilic/hexo-front-matter-editor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

npm version Build Status codecov

hexo-front-matter-editor

A simple library to read / write / create markdown files of hexo blog posts.

APIs

Editor.read(String from)

Read your hexo markdown file and parse it to an FrontMatterData object.

  • from / the path of your post markdown file.

returns Promise<FrontMatterData result>

Editor.create(Object initObj)

Create an FrontMatterData object.

returns FrontMatterData result;

Editor.write(FrontMatterData data, Object to)

  • initObj / a FrontMatterData object
  • to / the output markdown file path.

FrontMatterData APIs

It just a simple key-value pair handler.

FrontMatterData.add(String key, String | Date | Array | null | undefined value)

Add a key-value pair;

FrontMatterData.remove(String key, String | Date | Array | null | undefined value)

Remove key-value pair;

FrontMatterData.set(String key, String | Date | Array | null | undefined value)

Set an exist key with a new value. If key doesn't exist in object, it will add a new key-value pair instead.

Notice

All methods in FrontMatterData, you always should not to use Object (Date/Array/null are not included) as your value input. When you use Editor.write() to output your FrontMatterData to a markdown file(s), that Object value will be transformed to "[Object Object]". This is the default behavior of hexo-front-matter.

About

A simple library to read / edit / write markdown files of hexo blog posts.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published