mirror of
https://github.com/nasa/openmct.git
synced 2025-01-31 08:25:31 +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
|
||||
};
|
||||
|
||||
GLOBAL.window = GLOBAL.window || {}; // nomnoml expects window to be defined
|
||||
GLOBAL.window = GLOBAL.window || GLOBAL; // nomnoml expects window to be defined
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
@ -37,7 +37,7 @@ GLOBAL.window = GLOBAL.window || {}; // nomnoml expects window to be defined
|
||||
source = "";
|
||||
|
||||
transform._transform = function (chunk, encoding, done) {
|
||||
if (isBuilding) {
|
||||
if (!isBuilding) {
|
||||
if (chunk.trim().indexOf("```nomnoml") === 0) {
|
||||
var outputFilename = prefix + '-' + counter + '.png';
|
||||
outputPath = path.join(outputDirectory, outputFilename);
|
||||
@ -50,9 +50,10 @@ GLOBAL.window = GLOBAL.window || {}; // nomnoml expects window to be defined
|
||||
].join(""));
|
||||
isBuilding = true;
|
||||
source = "";
|
||||
counter += 1;
|
||||
} else {
|
||||
// Otherwise, pass through
|
||||
this.push(chunk);
|
||||
this.push(chunk + '\n');
|
||||
}
|
||||
} else {
|
||||
if (chunk.trim() === "```") {
|
||||
@ -60,26 +61,27 @@ GLOBAL.window = GLOBAL.window || {}; // nomnoml expects window to be defined
|
||||
renderNomnoml(source, outputPath);
|
||||
isBuilding = false;
|
||||
} else {
|
||||
source += chunk;
|
||||
source += chunk + '\n';
|
||||
}
|
||||
}
|
||||
done();
|
||||
};
|
||||
|
||||
return transform;
|
||||
}
|
||||
|
||||
function concat() {
|
||||
|
||||
}
|
||||
|
||||
function gfmifier() {
|
||||
var transform = new stream.Transform({ objectMode: true }),
|
||||
markdown = "";
|
||||
transform._transform = function (chunk, encoding, done) {
|
||||
markdown += chunk;
|
||||
done();
|
||||
};
|
||||
transform._flush = function () {
|
||||
this.push(markdown);
|
||||
transform._flush = function (done) {
|
||||
this.push("<html><body>\n");
|
||||
this.push(showdown.parse(markdown));
|
||||
this.push("\n</body></html>\n");
|
||||
done();
|
||||
};
|
||||
return transform;
|
||||
}
|
||||
|
@ -1,3 +1,12 @@
|
||||
# Hello, world!
|
||||
|
||||
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