Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/quoid/json-to-frontmatter-markdown
Transform json to a markdown file with frontmatter and body
https://github.com/quoid/json-to-frontmatter-markdown
Last synced: about 2 months ago
JSON representation
Transform json to a markdown file with frontmatter and body
- Host: GitHub
- URL: https://github.com/quoid/json-to-frontmatter-markdown
- Owner: quoid
- License: mit
- Fork: true (easybird/json-to-frontmatter-markdown)
- Created: 2021-05-09T16:59:39.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2021-10-21T20:04:22.000Z (about 3 years ago)
- Last Synced: 2024-09-25T21:16:18.605Z (about 2 months ago)
- Language: JavaScript
- Size: 170 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://github.com/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:
```javascript
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:
```markdown
---
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.🙏