@sigrix-io/gatehouse 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/package.json +1 -1
- package/src/run_renderer.js +8 -4
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ The run page draws the bundle's name as `<h1 class="run-title">`, which is right
|
|
|
78
78
|
new Gatehouse.RunRenderer(container, client, { titleLevel: 2 });
|
|
79
79
|
```
|
|
80
80
|
|
|
81
|
-
A number or numeric text (`'2'`) is read as a level; anything that does not read as a whole number from 1 to 6 (absent, `0`, `7`, `2.5`, other text) is the default, 1. Pass 2 for a page that has an `<h1>` of its own; from 3 on, the heading above the examples
|
|
81
|
+
A number or numeric text (`'2'`) is read as a level; anything that does not read as a whole number from 1 to 6 (absent, `0`, `7`, `2.5`, other text) is the default, 1. Pass 2 for a page that has an `<h1>` of its own; from 3 on, the heading above the examples is an `<h2>` and outranks the name. A result's own headings (Markdown output) sit beneath the name, except at `titleLevel: 6`, where no level is left and they are `<h6>`, level with it: `#` is drawn one level below it, each `#` after it one level further, over three levels, and nothing is drawn past `<h6>` (what would be stays at `<h6>`). At the default level that is `<h2>` to `<h4>`, as ever; at `titleLevel: 2`, `#` is an `<h3>` and `##` an `<h4>`. The heading above the examples stays an `<h2>`. The renderer draws no other `<h1>`.
|
|
82
82
|
|
|
83
83
|
## The composition
|
|
84
84
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sigrix-io/gatehouse",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A browser client for Postern: draws a run page from a describe document and connects it to the four verbs. No build step and no dependencies.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Sigrix",
|
package/src/run_renderer.js
CHANGED
|
@@ -791,12 +791,16 @@
|
|
|
791
791
|
|
|
792
792
|
renderMarkdown(value, into) {
|
|
793
793
|
const target = into || this.nodes.rendered;
|
|
794
|
+
const title = this.titleLevel;
|
|
794
795
|
NS.viewModel.outputBlocks(value).forEach(function (block) {
|
|
795
796
|
if (block.kind === 'heading') {
|
|
796
|
-
/*
|
|
797
|
-
*
|
|
798
|
-
*
|
|
799
|
-
|
|
797
|
+
/* A result's headings sit beneath the title, never beside it: `#`
|
|
798
|
+
* is drawn one level below the title and each `#` after it one
|
|
799
|
+
* level further, over three levels (title + 1 to title + 3), the
|
|
800
|
+
* span h2..h4 has always had under the default h1. Past h6 they
|
|
801
|
+
* stay at h6. An agent that emits `#` is describing its answer, not
|
|
802
|
+
* the page. */
|
|
803
|
+
const level = Math.min(6, title + 3, title + block.level);
|
|
800
804
|
target.appendChild(el('h' + level, 'run-md-heading', block.text));
|
|
801
805
|
return;
|
|
802
806
|
}
|