Skip to content

quoid/json-to-frontmatter-markdown

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

json-to-frontmatter-markdown

This library has only one feature: Transform a javascript object to markdown with frontmatter, and write it to a markdown file on a specified location.

The only difference between this and easybird/json-to-frontmatter-markdown is that numbers are not converted when transforming.

The following request, will result in the below markdown file on location /Users/user/path/to/dir/fileName.md:

  transformAndWriteToFile({
    frontmatterMarkdown: {
      frontMatter: [
        { var1: 'this is a string'},
        { var2: ['this is an array', 'element2']},
        { num1: 23 },
        { obj1: {
          var3: "var3"
        }},
      ],
      body: `
        # h1 Heading 8-)
        ## h2 Heading
        ### h3 Heading
        #### h4 Heading
        ##### h5 Heading
        ###### h6 Heading
        `
      },
      path: '/Users/user/path/to/dir',
      fileName: 'fileName.md'
    })

Result:

---
var1: "this is a string"
var2: ["this is an array","element2"]
num1: 23
obj1:
  var3: "var3"
---
# h1 Heading 8-)
## h2 Heading
### h3 Heading
#### h4 Heading
##### h5 Heading
###### h6 Heading

If you have a feature request or issues, don't hesitate to log an issue.🙏

About

Transform json to a markdown file with frontmatter and body

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%