README
hexo-front-matter-editor
A simple library to read / write / create markdown files of hexo blog posts.
APIs
String
from)
Editor.read(Read your hexo markdown file and parse it to an FrontMatterData object.
- from / the path of your post markdown file.
returns Promise<FrontMatterData
result>
Object
initObj)
Editor.create(Create an FrontMatterData object.
returns FrontMatterData
result;
FrontMatterData
data, Object
to)
Editor.write(- initObj / a FrontMatterData object
- to / the output markdown file path.
APIs FrontMatterData
It just a simple key-value pair handler.
String
key, String | Date | Array | null | undefined
value)
FrontMatterData.add(Add a key-value pair;
String
key, String | Date | Array | null | undefined
value)
FrontMatterData.remove(Remove key-value pair;
String
key, String | Date | Array | null | undefined
value)
FrontMatterData.set(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.