Skip to content

Commit 3d2c044

Browse files
authored
Rendered spec, generate latest.html and add DOCTYPE (#2607)
* fix: md2html/build.sh specify bash in shebang Signed-off-by: Mike Ralphson <[email protected]> * fix: changes for abstract title in md2html.js Signed-off-by: Mike Ralphson <[email protected]>
1 parent 946f590 commit 3d2c044

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

scripts/md2html/build.sh

+5-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
#!/bin/sh
1+
#!/bin/bash
22

3-
# run this script from the root of the repo
3+
# Author: @MikeRalphson
4+
5+
# run this script from the root of the repo. It is designed to be run by a GitHub workflow.
6+
# It contains bashisms
47

58
mkdir -p deploy/oas
69
mkdir -p deploy/js

scripts/md2html/md2html.js

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ let argv = require('yargs')
2626
.describe('maintainers','path to MAINTAINERS.md')
2727
.require(1)
2828
.argv;
29+
const abstract = 'What is the OpenAPI Specification?';
2930
let maintainers = [];
3031
let emeritus = [];
3132

@@ -66,14 +67,14 @@ function preface(title,options) {
6667
includePermalinks: true
6768
};
6869

69-
let preface = `<html lang="en"><head><meta charset="UTF-8"><title>${md.utils.escapeHtml(title)}</title>`;
70+
let preface = `<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>${md.utils.escapeHtml(title)}</title>`;
7071

7172
// SEO
7273
preface += '<meta name="description" content="The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs.">';
7374
preface += '<link rel="canonical" href="https://spec.openapis.org/oas/latest.html" />';
7475

7576
if (options.respec) {
76-
preface += '<script src="https://spec.openapis.org/js/respec-oai.js" class="remove"></script>';
77+
preface += '<script src="../js/respec-oai.js" class="remove"></script>';
7778
preface += `<script class="remove">var respecConfig = ${JSON.stringify(respec)};</script>`;
7879
preface += fs.readFileSync('./analytics/google.html','utf8');
7980
preface += '</head><body>';
@@ -90,7 +91,8 @@ function preface(title,options) {
9091
preface += 'pre { background-color: #f6f8fa !important; }';
9192
preface += fs.readFileSync(path.resolve(__dirname,'gist.css'),'utf8').split('\n').join(' ');
9293
preface += '</style>';
93-
preface += '<section id="abstract">';
94+
preface += `<h1 id="title">${title.split('|')[0]}</h1>`;
95+
preface += `<section id="abstract" title="${abstract}">`;
9496
preface += 'The OpenAPI Specification (OAS) defines a standard, programming language-agnostic interface description for HTTP APIs, which allows both humans and computers to discover and understand the capabilities of a service without requiring access to source code, additional documentation, or inspection of network traffic. When properly defined via OpenAPI, a consumer can understand and interact with the remote service with a minimal amount of implementation logic. Similar to what interface descriptions have done for lower-level programming, the OpenAPI Specification removes guesswork in calling a service.';
9597
preface += '</section>';
9698
preface += '<section class="notoc" id="sotd">';

0 commit comments

Comments
 (0)