mirror of
https://github.com/nasa/openmct.git
synced 2025-05-03 09:12:51 +00:00
[Documentation] Generate docs with diagram
Convert Markdown+nomnoml -> HTML+PNG for MissionControl/vista#21
This commit is contained in:
parent
ad482600de
commit
ee64ef5fc1
@ -7,7 +7,7 @@ var CONSTANTS = {
|
|||||||
DIAGRAM_HEIGHT: 500
|
DIAGRAM_HEIGHT: 500
|
||||||
};
|
};
|
||||||
|
|
||||||
GLOBAL.window = GLOBAL.window || {}; // nomnoml expects window to be defined
|
GLOBAL.window = GLOBAL.window || GLOBAL; // nomnoml expects window to be defined
|
||||||
(function () {
|
(function () {
|
||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ GLOBAL.window = GLOBAL.window || {}; // nomnoml expects window to be defined
|
|||||||
source = "";
|
source = "";
|
||||||
|
|
||||||
transform._transform = function (chunk, encoding, done) {
|
transform._transform = function (chunk, encoding, done) {
|
||||||
if (isBuilding) {
|
if (!isBuilding) {
|
||||||
if (chunk.trim().indexOf("```nomnoml") === 0) {
|
if (chunk.trim().indexOf("```nomnoml") === 0) {
|
||||||
var outputFilename = prefix + '-' + counter + '.png';
|
var outputFilename = prefix + '-' + counter + '.png';
|
||||||
outputPath = path.join(outputDirectory, outputFilename);
|
outputPath = path.join(outputDirectory, outputFilename);
|
||||||
@ -50,9 +50,10 @@ GLOBAL.window = GLOBAL.window || {}; // nomnoml expects window to be defined
|
|||||||
].join(""));
|
].join(""));
|
||||||
isBuilding = true;
|
isBuilding = true;
|
||||||
source = "";
|
source = "";
|
||||||
|
counter += 1;
|
||||||
} else {
|
} else {
|
||||||
// Otherwise, pass through
|
// Otherwise, pass through
|
||||||
this.push(chunk);
|
this.push(chunk + '\n');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (chunk.trim() === "```") {
|
if (chunk.trim() === "```") {
|
||||||
@ -60,26 +61,27 @@ GLOBAL.window = GLOBAL.window || {}; // nomnoml expects window to be defined
|
|||||||
renderNomnoml(source, outputPath);
|
renderNomnoml(source, outputPath);
|
||||||
isBuilding = false;
|
isBuilding = false;
|
||||||
} else {
|
} else {
|
||||||
source += chunk;
|
source += chunk + '\n';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
done();
|
||||||
};
|
};
|
||||||
|
|
||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
|
||||||
function concat() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function gfmifier() {
|
function gfmifier() {
|
||||||
var transform = new stream.Transform({ objectMode: true }),
|
var transform = new stream.Transform({ objectMode: true }),
|
||||||
markdown = "";
|
markdown = "";
|
||||||
transform._transform = function (chunk, encoding, done) {
|
transform._transform = function (chunk, encoding, done) {
|
||||||
markdown += chunk;
|
markdown += chunk;
|
||||||
|
done();
|
||||||
};
|
};
|
||||||
transform._flush = function () {
|
transform._flush = function (done) {
|
||||||
this.push(markdown);
|
this.push("<html><body>\n");
|
||||||
|
this.push(showdown.parse(markdown));
|
||||||
|
this.push("\n</body></html>\n");
|
||||||
|
done();
|
||||||
};
|
};
|
||||||
return transform;
|
return transform;
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,12 @@
|
|||||||
# Hello, world!
|
# Hello, world!
|
||||||
|
|
||||||
This is a placeholder for the developer guide.
|
This is a placeholder for the developer guide.
|
||||||
|
|
||||||
|
```nomnoml
|
||||||
|
[<start> Start]->[<state> Load bundles.json]
|
||||||
|
[Load bundles.json]->[<state> Load bundle.json files]
|
||||||
|
[Load bundle.json files]->[<state> Resolve implementations]
|
||||||
|
[Resolve implementations]->[<state> Register with Angular]
|
||||||
|
[Register with Angular]->[<state> Bootstrap application]
|
||||||
|
[Bootstrap application]->[<end> End]
|
||||||
|
```
|
||||||
|
Loading…
x
Reference in New Issue
Block a user