Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add option to use custom widdershins templates #27

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions bin/api2html.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ program
.option("-S, --summary", "use summary instead of operationId for TOC")
.option("-b, --omitBody", "Omit top-level fake body parameter object")
.option("-R, --raw", "Show raw schemas in samples, not example values")
.option("-T, --templates <dir>", "use custom widdershins templates from the given directory")
.parse(process.argv);

if (program.args.length === 0) {
Expand Down Expand Up @@ -73,6 +74,10 @@ if (program.args.length === 0) {
options.language_tabs = [];
options.sample = !program.raw;

if (program.templates) {
options.user_templates= program.templates;
}

// Default languages: All
Object.getOwnPropertyNames(languageMap).forEach((lang) => {
let obj = {};
Expand Down Expand Up @@ -131,7 +136,7 @@ if (program.args.length === 0) {
if (program.customCss) {
shinOptions.customCss = true;
}

let customCss = "";
if (program.customCssPath) {
shinOptions.customCss = true;
Expand Down Expand Up @@ -181,7 +186,7 @@ if (program.args.length === 0) {
}

console.log(chalk.green(icons.ok) + " Rendered HTML from markdown!");

if (customCss) {
html = html.replace (/\/\* place your custom CSS overrides here \*\//i, customCss);
}
Expand Down