fix: Typo for documents and comments

This commit is contained in:
yutotnh
2022-06-22 12:39:10 +09:00
parent 566ec14648
commit ca909edbed
29 changed files with 43 additions and 43 deletions

View File

@@ -15,7 +15,7 @@ English | [简体中文](./README.zh-CN.md)
## About ## About
<!-- <Main description> --> <!-- <Main description> -->
Mermaid is a Javascript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. The main purpose of Mermaid is to help documentation catch up with development. Mermaid is a JavaScript based diagramming and charting tool that uses Markdown-inspired text definitions and a renderer to create and modify complex diagrams. The main purpose of Mermaid is to help documentation catch up with development.
> Doc-Rot is a Catch-22 that Mermaid helps to solve. > Doc-Rot is a Catch-22 that Mermaid helps to solve.

View File

@@ -118,7 +118,7 @@ Default value: ['secure', 'securityLevel', 'startOnLoad', 'maxTextSize']
This option controls if the generated ids of nodes in the SVG are generated randomly or based This option controls if the generated ids of nodes in the SVG are generated randomly or based
on a seed. If set to false, the IDs are generated based on the current date and thus are not on a seed. If set to false, the IDs are generated based on the current date and thus are not
deterministic. This is the default behaviour. deterministic. This is the default behavior.
**Notes**: **Notes**:

View File

@@ -5,7 +5,7 @@
Mermaid's c4 diagram sytax is compatible with plantUML. See example below: Mermaid's c4 diagram syntax is compatible with plantUML. See example below:
```mermaid-example ```mermaid-example
C4Context C4Context

View File

@@ -189,12 +189,12 @@ To use the `cherry-pick` keyword, you must specify the id using the `id` attrib
`cherry-pick id: "your_custom_id"` `cherry-pick id: "your_custom_id"`
Here, a new commt representing the cherry pick is created on the current branch, and is visually highlighted in the diagram with a **cherry** and a tag depicting the commit id from which it is cherry picked from. Here, a new commit representing the cherry pick is created on the current branch, and is visually highlighted in the diagram with a **cherry** and a tag depicting the commit id from which it is cherry picked from.
Few Important rules to note here are: Few Important rules to note here are:
1. You need to provide the `id` for an existing commit to be cherry picked. If given commit id does not exist it will result in an error. For this make use of the `commit id:$value` format of declaring commits. See the examples from above. 1. You need to provide the `id` for an existing commit to be cherry picked. If given commit id does not exist it will result in an error. For this make use of the `commit id:$value` format of declaring commits. See the examples from above.
2. The given commit must not exist on the current branch. Cherry picked commit must always be a different branch than the current branch. 2. The given commit must not exist on the current branch. Cherry picked commit must always be a different branch than the current branch.
3. Current branch must have atleast one commit, before you can cherry pick a commit, otherwise it will case an error is throw. 3. Current branch must have at least one commit, before you can cherry pick a commit, otherwise it will cause an error is throw.
Let see an example: Let see an example:
```mermaid-example ```mermaid-example
@@ -272,7 +272,7 @@ Usage example:
``` ```
## Commit labels Layout: Rotated or Horizontal ## Commit labels Layout: Rotated or Horizontal
Mermaid supports two types of commit labels layout. The default layout is **rotated**, which means the labels are placed below the commit circle, rotated at 45 degress for better readability. This is particularly useful for commits with long labels. Mermaid supports two types of commit labels layout. The default layout is **rotated**, which means the labels are placed below the commit circle, rotated at 45 degrees for better readability. This is particularly useful for commits with long labels.
The other option is **horizontal**, which means the labels are placed below the commit circle centred horizontally, and are not rotated. This is particularly useful for commits with short labels. The other option is **horizontal**, which means the labels are placed below the commit circle centred horizontally, and are not rotated. This is particularly useful for commits with short labels.

View File

@@ -110,7 +110,7 @@ Look at `graphDb.js` for more details on that object.
## Layout ## Layout
If you are using a dagre based layout, please use flowchart-v2 as a template and by doing that you will be using dagre-wrapper instead of dagreD3 which we are m igrating away from. If you are using a dagre based layout, please use flowchart-v2 as a template and by doing that you will be using dagre-wrapper instead of dagreD3 which we are migrating away from.
### Common parts of a diagram ### Common parts of a diagram
@@ -129,7 +129,7 @@ Here is example handling from flowcharts:
Jison: Jison:
```jison ```jison
/* lexial grammar */ /* lexical grammar */
%lex %lex
%x open_directive %x open_directive
%x type_directive %x type_directive
@@ -175,7 +175,7 @@ It is probably a good idea to keep the handling similar to this in your new diag
The syntax for adding title and description looks like this: The syntax for adding title and description looks like this:
``` ```
accTitle: The title accTitle: The title
accDescr: The dsscription accDescr: The description
accDescr { accDescr {
Syntax for a description text Syntax for a description text

View File

@@ -23,7 +23,7 @@ flowchart
The new nodes C1 and C2 are a special type of nodes, clusterNodes. ClusterNodes have have the nodes in the cluster including the cluster attached in a graph object. The new nodes C1 and C2 are a special type of nodes, clusterNodes. ClusterNodes have have the nodes in the cluster including the cluster attached in a graph object.
When rendering this diagram it it beeing rendered recursivly. The diagram is rendered by the dagre-mermaid:render function which in turn will be used to render the node C1 and the node C2. The result of those renderings will be inserted as nodes in the "root" diagram. With this recursive approach it would be possible to have different layout direction for each cluster. When rendering this diagram it it beeing rendered recursively. The diagram is rendered by the dagre-mermaid:render function which in turn will be used to render the node C1 and the node C2. The result of those renderings will be inserted as nodes in the "root" diagram. With this recursive approach it would be possible to have different layout direction for each cluster.
``` ```
{ clusterNode: true, graph } { clusterNode: true, graph }
@@ -74,7 +74,7 @@ This is set by the renderer of the diagram and insert the data that the wrapper
| property | description | | property | description |
| ---------- | ----------------------------------------------------------------------------------------------------------- | | ---------- | ----------------------------------------------------------------------------------------------------------- |
| labelStyle | Css styles for the label. User for instance for stylling the labels for clusters | | labelStyle | Css styles for the label. User for instance for styling the labels for clusters |
| shape | The shape of the node. | | shape | The shape of the node. |
| labelText | The text on the label | | labelText | The text on the label |
| rx | The corner radius - maybe part of the shape instead? Used for rects. | | rx | The corner radius - maybe part of the shape instead? Used for rects. |

View File

@@ -78,7 +78,7 @@ const rect = (parent, node) => {
}; };
/** /**
* Non visiable cluster where the note is group with its * Non visible cluster where the note is group with its
* *
* @param {any} parent * @param {any} parent
* @param {any} node * @param {any} node

View File

@@ -313,7 +313,7 @@ const cutPathAtIntersect = (_points, boundryNode) => {
// check if point is inside the boundry rect // check if point is inside the boundry rect
if (!outsideNode(boundryNode, point) && !isInside) { if (!outsideNode(boundryNode, point) && !isInside) {
// First point inside the rect found // First point inside the rect found
// Calc the intersection coord between the point anf the last opint ouside the rect // Calc the intersection coord between the point anf the last point outside the rect
const inter = intersection(boundryNode, lastPointOutside, point); const inter = intersection(boundryNode, lastPointOutside, point);
log.warn('abc88 inside', point, lastPointOutside, inter); log.warn('abc88 inside', point, lastPointOutside, inter);
log.warn('abc88 intersection', inter); log.warn('abc88 intersection', inter);
@@ -391,7 +391,7 @@ export const insertEdge = function (elem, e, edge, clusterDb, diagramType, graph
// } // }
// isInside = true; // isInside = true;
// } else { // } else {
// // outtside // // outside
// lastPointOutside = point; // lastPointOutside = point;
// if (!isInside) points.push(point); // if (!isInside) points.push(point);
// } // }

View File

@@ -61,7 +61,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
log.warn('Recursive render complete ', newEl, node); log.warn('Recursive render complete ', newEl, node);
} else { } else {
if (graph.children(v).length > 0) { if (graph.children(v).length > 0) {
// This is a cluster but not to be rendered recusively // This is a cluster but not to be rendered recursively
// Render as before // Render as before
log.info('Cluster - the non recursive path XXX', v, node.id, node, graph); log.info('Cluster - the non recursive path XXX', v, node.id, node, graph);
log.info(findNonClusterChild(node.id, graph)); log.info(findNonClusterChild(node.id, graph));
@@ -117,7 +117,7 @@ const recursiveRender = (_elem, graph, diagramtype, parentCluster) => {
} else { } else {
// Non cluster node // Non cluster node
if (graph.children(v).length > 0) { if (graph.children(v).length > 0) {
// A cluster in the non-recurive way // A cluster in the non-recursive way
// positionCluster(node); // positionCluster(node);
insertCluster(clusters, node); insertCluster(clusters, node);
clusterDb[node.id].node = node; clusterDb[node.id].node = node;

View File

@@ -244,7 +244,7 @@ const barb = (elem, type) => {
.attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z'); .attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z');
}; };
// TODO rename the class diagram markers to something shape descriptive and semanitc free // TODO rename the class diagram markers to something shape descriptive and semantic free
const markers = { const markers = {
extension, extension,
composition, composition,

View File

@@ -210,7 +210,7 @@ export const adjustClustersAndEdges = (graph, depth) => {
} else { } else {
log.debug('Opting in, graph '); log.debug('Opting in, graph ');
} }
// Go through the nodes and for each cluster found, save a replacment node, this can be used when // Go through the nodes and for each cluster found, save a replacement node, this can be used when
// faking a link to a cluster // faking a link to a cluster
graph.nodes().forEach(function (id) { graph.nodes().forEach(function (id) {
const children = graph.children(id); const children = graph.children(id);
@@ -257,7 +257,7 @@ export const adjustClustersAndEdges = (graph, depth) => {
}); });
// For clusters with incoming and/or outgoing edges translate those edges to a real node // For clusters with incoming and/or outgoing edges translate those edges to a real node
// in the cluster inorder to fake the edge // in the cluster in order to fake the edge
graph.edges().forEach(function (e) { graph.edges().forEach(function (e) {
const edge = graph.edge(e); const edge = graph.edge(e);
log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e)); log.warn('Edge ' + e.v + ' -> ' + e.w + ': ' + JSON.stringify(e));

View File

@@ -877,7 +877,7 @@ const class_box = (parent, node) => {
); );
verticalPos = interfaceBBox.height + rowPadding; verticalPos = interfaceBBox.height + rowPadding;
} }
// Positin the class title label // Position the class title label
let diffX = (maxWidth - classTitleBBox.width) / 2; let diffX = (maxWidth - classTitleBBox.width) / 2;
select(classTitleLabel).attr( select(classTitleLabel).attr(
'transform', 'transform',

View File

@@ -45,7 +45,7 @@ const dots = (elem, type) => {
.attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z'); .attr('d', 'M 19,7 L9,13 L14,7 L9,1 Z');
}; };
// TODO rename the class diagram markers to something shape descriptive and semanitc free // TODO rename the class diagram markers to something shape descriptive and semantic free
const patterns = { const patterns = {
dots, dots,
}; };

View File

@@ -568,7 +568,7 @@ function drawInsideBoundary(diagram, parentBoundaryAlias, parentBounds, currentB
export const draw = function (text, id) { export const draw = function (text, id) {
conf = configApi.getConfig().c4; conf = configApi.getConfig().c4;
const securityLevel = configApi.getConfig().securityLevel; const securityLevel = configApi.getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -315,7 +315,7 @@ const drawBoundary = function (elem, boundary, conf) {
drawRect(boundaryElem, rectData); drawRect(boundaryElem, rectData);
// draw lable // draw label
let boundaryConf = conf.boundaryFont(); let boundaryConf = conf.boundaryFont();
boundaryConf.fontWeight = 'bold'; boundaryConf.fontWeight = 'bold';
boundaryConf.fontSize = boundaryConf.fontSize + 2; boundaryConf.fontSize = boundaryConf.fontSize + 2;

View File

@@ -138,7 +138,7 @@ export const addClasses = function (classes, g) {
}; };
/** /**
* Add edges to graph based on parsed graph defninition * Add edges to graph based on parsed graph definition
* *
* @param relations * @param relations
* @param {object} g The graph object * @param {object} g The graph object
@@ -317,7 +317,7 @@ export const draw = function (text, id) {
// flowDb.addVertex(subG.id, subG.title, 'group', undefined, subG.classes); // flowDb.addVertex(subG.id, subG.title, 'group', undefined, subG.classes);
// } // }
// Fetch the verices/nodes and edges/links from the parsed graph definition // Fetch the vertices/nodes and edges/links from the parsed graph definition
const classes = classDb.getClasses(); const classes = classDb.getClasses();
const relations = classDb.getRelations(); const relations = classDb.getRelations();

View File

@@ -168,7 +168,7 @@ export const draw = function (text, id) {
log.info('Rendering diagram ' + text); log.info('Rendering diagram ' + text);
const securityLevel = getConfig().securityLevel; const securityLevel = getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -547,7 +547,7 @@ export const draw = function (text, id) {
const parser = erParser.parser; const parser = erParser.parser;
parser.yy = erDb; parser.yy = erDb;
const securityLevel = getConfig().securityLevel; const securityLevel = getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);
@@ -575,7 +575,7 @@ export const draw = function (text, id) {
// --- // ---
// 1. Create all the entities in the svg node at 0,0, but with the correct dimensions (allowing for text content) // 1. Create all the entities in the svg node at 0,0, but with the correct dimensions (allowing for text content)
// 2. Make sure they are all added to the graph // 2. Make sure they are all added to the graph
// 3. Add all the edges (relationships) to the graph aswell // 3. Add all the edges (relationships) to the graph as well
// 4. Let dagre do its magic to layout the graph. This assigns: // 4. Let dagre do its magic to layout the graph. This assigns:
// - the centre co-ordinates for each node, bearing in mind the dimensions and edge relationships // - the centre co-ordinates for each node, bearing in mind the dimensions and edge relationships
// - the path co-ordinates for each edge // - the path co-ordinates for each edge

View File

@@ -465,7 +465,7 @@ export const addSubGraph = function (_id, list, _title) {
const prims = { boolean: {}, number: {}, string: {} }; const prims = { boolean: {}, number: {}, string: {} };
const objs = []; const objs = [];
let dir; // = unbdefined; direction.trim(); let dir; // = undefined; direction.trim();
const nodeList = a.filter(function (item) { const nodeList = a.filter(function (item) {
const type = typeof item; const type = typeof item;
if (item.stmt && item.stmt === 'dir') { if (item.stmt && item.stmt === 'dir') {

View File

@@ -30,7 +30,7 @@ export const draw = function (text, id) {
parser.parse(text); parser.parse(text);
const securityLevel = getConfig().securityLevel; const securityLevel = getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -65,9 +65,9 @@ const drawText = (txt) => {
}; };
/** /**
* Draws the commits with its symbol and labels. The function has tywo modes, one which only * Draws the commits with its symbol and labels. The function has two modes, one which only
* calculates the positions and one that does the actual drawing. This for a simple way getting the * calculates the positions and one that does the actual drawing. This for a simple way getting the
* vertical leyering rcorrect in the graph. * vertical layering correct in the graph.
* *
* @param {any} svg * @param {any} svg
* @param {any} commits * @param {any} commits
@@ -345,7 +345,7 @@ const findLane = (y1, y2, _depth) => {
}; };
/** /**
* This function draw trhe lines between the commits. They were arrows initially. * This function draw the lines between the commits. They were arrows initially.
* *
* @param {any} svg * @param {any} svg
* @param {any} commit1 * @param {any} commit1

View File

@@ -28,7 +28,7 @@ export const draw = (text, id, version) => {
log.debug('Renering info diagram\n' + text); log.debug('Renering info diagram\n' + text);
const securityLevel = getConfig().securityLevel; const securityLevel = getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -25,7 +25,7 @@ export const draw = (txt, id) => {
log.debug('Rendering info diagram\n' + txt); log.debug('Rendering info diagram\n' + txt);
const securityLevel = configApi.getConfig().securityLevel; const securityLevel = configApi.getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -324,7 +324,7 @@ export const draw = (text, id) => {
parser.parse(text); parser.parse(text);
const securityLevel = getConfig().securityLevel; const securityLevel = getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -587,7 +587,7 @@ function adjustLoopHeightForWrap(loopWidths, msg, preMargin, postMargin, addLoop
export const draw = function (text, id) { export const draw = function (text, id) {
conf = configApi.getConfig().sequence; conf = configApi.getConfig().sequence;
const securityLevel = configApi.getConfig().securityLevel; const securityLevel = configApi.getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -362,7 +362,7 @@ export const drawNote = (text, g) => {
/** /**
* Starting point for drawing a state. The function finds out the specifics about the state and * Starting point for drawing a state. The function finds out the specifics about the state and
* renders with approprtiate function. * renders with appropriate function.
* *
* @param {any} elem * @param {any} elem
* @param {any} stateDef * @param {any} stateDef

View File

@@ -48,7 +48,7 @@ const insertMarkers = function (elem) {
export const draw = function (text, id) { export const draw = function (text, id) {
conf = getConfig().state; conf = getConfig().state;
const securityLevel = getConfig().securityLevel; const securityLevel = getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -56,7 +56,7 @@ export const draw = function (text, id) {
parser.parse(text + '\n'); parser.parse(text + '\n');
const securityLevel = getConfig().securityLevel; const securityLevel = getConfig().securityLevel;
// Handle root and ocument for when rendering in sanbox mode // Handle root and Document for when rendering in sanbox mode
let sandboxElement; let sandboxElement;
if (securityLevel === 'sandbox') { if (securityLevel === 'sandbox') {
sandboxElement = select('#i' + id); sandboxElement = select('#i' + id);

View File

@@ -5,7 +5,7 @@ class Theme {
/** # Base variables */ /** # Base variables */
/** /**
* - Background - used to know what the background color is of the diagram. This is used for * - Background - used to know what the background color is of the diagram. This is used for
* deducing colors for istance line color. Defaulr value is #f4f4f4. * deducing colors for instance line color. Default value is #f4f4f4.
*/ */
this.background = '#f4f4f4'; this.background = '#f4f4f4';
this.darkMode = false; this.darkMode = false;
@@ -21,7 +21,7 @@ class Theme {
this.fontSize = '16px'; this.fontSize = '16px';
} }
updateColors() { updateColors() {
// The || is to make sure that if the variable has been defiend by a user override that value is to be used // The || is to make sure that if the variable has been defined by a user override that value is to be used
/* Main */ /* Main */
this.primaryTextColor = this.primaryTextColor || (this.darkMode ? '#eee' : '#333'); // invert(this.primaryColor); this.primaryTextColor = this.primaryTextColor || (this.darkMode ? '#eee' : '#333'); // invert(this.primaryColor);
@@ -103,7 +103,7 @@ class Theme {
/* state colors */ /* state colors */
this.transitionColor = this.transitionColor || this.lineColor; this.transitionColor = this.transitionColor || this.lineColor;
this.transitionLabelColor = this.transitionLabelColor || this.textColor; this.transitionLabelColor = this.transitionLabelColor || this.textColor;
/* The color of the text tables of the tstates*/ /* The color of the text tables of the states*/
this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor; this.stateLabelColor = this.stateLabelColor || this.stateBkg || this.primaryTextColor;
this.stateBkg = this.stateBkg || this.mainBkg; this.stateBkg = this.stateBkg || this.mainBkg;