diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index ef95f67761..d177a5bd3c 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -120,7 +120,7 @@ function preface(title,options) { preface += `

${title.split('|')[0]}

`; preface += ``; preface += `

${abstract}

`; - 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.'; + preface += options.intro.join('\n'); preface += '
'; preface += '
'; preface += '

Status of This Document

'; @@ -183,11 +183,24 @@ let inTOC = false; let inDefs = false; let inCodeBlock = false; let indents = [0]; +let inIntro = false; +argv.intro = []; // process the markdown for (let l in lines) { let line = lines[l]; + // fix version 2.0 + if (line.startsWith('## (fka')) line = line.substring(3); + + // extract Introduction section for abstract + if (line.startsWith('## Introduction')) { inIntro = true; line = ''; } + else if (line.startsWith('#')) inIntro = false; + else if (inIntro) { + argv.intro.push(line); + line = ''; + } + // remove TOC from older spec versions, respec will generate a new one if (line.startsWith('## Table of Contents')) inTOC = true; else if (line.startsWith('#')) inTOC = false; diff --git a/tests/md2html/fixtures/basic-new.html b/tests/md2html/fixtures/basic-new.html index f9fecd4a12..d77dc5263a 100644 --- a/tests/md2html/fixtures/basic-new.html +++ b/tests/md2html/fixtures/basic-new.html @@ -1,4 +1,8 @@ -OpenAPI Specification v30.0.1 | Introduction, Definitions, & More

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

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.

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.
+OpenAPI Specification v30.0.1 | Introduction, Definitions, & More

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

+

The contents of the Introduction section will become the abstract. +It may contain of multiple lines.

+

It may have multiple paragraphs.

+

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.

Heading 1

Text for first chapter

Version 30.0.1

diff --git a/tests/md2html/fixtures/basic-new.md b/tests/md2html/fixtures/basic-new.md index 8d0c1e6efd..03579473f1 100644 --- a/tests/md2html/fixtures/basic-new.md +++ b/tests/md2html/fixtures/basic-new.md @@ -6,6 +6,13 @@ Text for first chapter This is the conformance section +## Introduction + +The contents of the Introduction section will become the abstract. +It may contain of multiple lines. + +It may have multiple paragraphs. + ## Heading 2 Text for first section diff --git a/tests/md2html/fixtures/basic-old.html b/tests/md2html/fixtures/basic-old.html index a80b4489fb..d2d0f1b12b 100644 --- a/tests/md2html/fixtures/basic-old.html +++ b/tests/md2html/fixtures/basic-old.html @@ -1,5 +1,8 @@ -OpenAPI Specification v30.0.1 | Introduction, Definitions, & More

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

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.

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.
+OpenAPI Specification v30.0.1 | Introduction, Definitions, & More

OpenAPI Specification v30.0.1

What is the OpenAPI Specification?

+

Intro headline only needs to start with ## Introduction.

+

Status of This Document

The source-of-truth for this specification is the HTML file referenced above as This version.

Heading 1

+

(fka something completely different)

Text for first chapter

Version 30.0.1

This is the conformance section

diff --git a/tests/md2html/fixtures/basic-old.md b/tests/md2html/fixtures/basic-old.md index 22be28ae57..8e4bc08091 100644 --- a/tests/md2html/fixtures/basic-old.md +++ b/tests/md2html/fixtures/basic-old.md @@ -1,4 +1,5 @@ # Heading 1 +## (fka something completely different) Text for first chapter @@ -6,6 +7,10 @@ Text for first chapter This is the conformance section +## Introductions + +Intro headline only needs to start with `## Introduction`. + ## Table of Contents Will be removed