From 3a70513b258d3390bbbea28e5b76da44781bea52 Mon Sep 17 00:00:00 2001 From: Ralf Handl Date: Thu, 8 Aug 2024 20:37:17 +0200 Subject: [PATCH 1/3] md2html: improved code blocks --- scripts/md2html/md2html.js | 176 +++++++++++++++---------------------- 1 file changed, 73 insertions(+), 103 deletions(-) diff --git a/scripts/md2html/md2html.js b/scripts/md2html/md2html.js index 40d4230800..27660ddc28 100644 --- a/scripts/md2html/md2html.js +++ b/scripts/md2html/md2html.js @@ -5,8 +5,8 @@ complete control over formatting and syntax highlighting */ 'use strict'; /** -@author Mike Ralphson -**/ + * @author Mike Ralphson + **/ const fs = require('fs'); const path = require('path'); @@ -34,9 +34,9 @@ const md = require('markdown-it')({ linkify: true, typographer: true, highlight: function (str, lang) { - if (lang && hljs.getLanguage(lang)) { // && !argv.respec) { + if (lang && hljs.getLanguage(lang)) { try { - return '
' +
+              return '
' +
                   hljs.highlight(str, { language: lang }).value +
                   '
'; } catch (__) { } @@ -86,56 +86,9 @@ function preface(title,options) { ], }, ], - localBiblio: { - "OpenAPI-Learn": { - title: "OpenAPI - Getting started, and the specification explained", - href: "https://learn.openapis.org/", - publisher: "OpenAPI Initiative" - }, - "OpenAPI-Registry": { - title: "OpenAPI Initiative Registry", - href: "https://spec.openapis.org/registry/index.html", - publisher: "OpenAPI Initiative" - }, - //TODO: remove localBiblio once Specref PRs https://github.com/tobie/specref/pulls/ralfhandl are merged - "JSON-Schema-Validation-04": { - authors: [ "Kris Zyp", "Francis Galiegue", "Gary Court" ], - href: "https://datatracker.ietf.org/doc/html/draft-fge-json-schema-validation-00", - publisher: "Internet Engineering Task Force (IETF)", - status: "Internet-Draft", - title: "JSON Schema: interactive and non interactive validation. Draft 4", - date: "1 February 2013" - }, - "JSON-Schema-05": { - authors: [ "Austin Wright" ], - href: "https://datatracker.ietf.org/doc/html/draft-wright-json-schema-00", - publisher: "Internet Engineering Task Force (IETF)", - status: "Internet-Draft", - title: "JSON Schema: A Media Type for Describing JSON Documents. Draft 5", - date: "13 October 2016" - }, - "JSON-Schema-Validation-05": { - authors: [ "Austin Wright", "G. Luff" ], - href: "https://datatracker.ietf.org/doc/html/draft-wright-json-schema-validation-00", - publisher: "Internet Engineering Task Force (IETF)", - status: "Internet-Draft", - title: "JSON Schema Validation: A Vocabulary for Structural Validation of JSON. Draft 5", - date: "13 October 2016" - }, - "JSON-Schema-Validation-2020-12": { - authors: [ "Austin Wright", "Henry Andrews", "Ben Hutton" ], - href: "https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00", - publisher: "Internet Engineering Task Force (IETF)", - status: "Internet-Draft", - title: "JSON Schema Validation: A Vocabulary for Structural Validation of JSON. Draft 2020-12", - date: "8 December 2020" - }, - "SPDX": { - href: "https://spdx.org/licenses/", - title: "SPDX License List", - publisher: "Linux Foundation" - } - } + // localBiblio: { + // // add local bibliography entries here, add them to https://www.specref.org/, and remove them here once published + // } }; let preface = `${md.utils.escapeHtml(title)}`; @@ -154,9 +107,10 @@ function preface(title,options) { preface += ''; preface += '