-
-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support for YAML frontmatter (#71)
- Loading branch information
1 parent
7675f23
commit 387c137
Showing
10 changed files
with
61 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Text } from "@asyncapi/generator-react-sdk"; | ||
|
||
import * as fs from "fs"; | ||
import * as yaml from "yaml"; | ||
|
||
export function FrontMatter({ asyncapi, params }) { | ||
const frontMatter = yaml.parse(fs.readFileSync(params.frontMatter,'utf8')); | ||
let frontMatterStr = yaml.stringify(frontMatter); | ||
frontMatterStr = frontMatterStr.split('{{title}}').join(asyncapi.info().title()); | ||
frontMatterStr = frontMatterStr.split('{{version}}').join(params.version || asyncapi.info().version()); | ||
return <Text newLines={2}>{`---\n${frontMatterStr}---`}</Text> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
|
||
# example of a frontMatter file for the Slate documentation generator | ||
# see https://github.com/Slatedocs/Slate | ||
|
||
title: '{{title}} version {{version}}' | ||
language_tabs: [ { shell: "Shell" }, { javascript: "Node.js" } ] | ||
toc_footers: [ "Built with AsyncAPI/Generator" ] | ||
includes: [] | ||
search: true | ||
code_clipboard: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
|
||
# example of a frontMatter file for a static site generator | ||
|
||
title: AsyncAPI Documentation | ||
layout: asyncapi | ||
permalink: /asyncapi-docs |