Documentation
¶
Overview ¶
Package limu reads Mermaid diagrams and lays them out, in Go, for programs that draw them themselves: on a GPU, in a terminal, as SVG.
A diagram goes through three stages, each a package of its own:
- parsing reads the diagram's text into a model of it;
- layout places the model's parts, measuring text with a text.Measurer the host gives, into a scene.Scene: what each part is and where it is, but not how it looks;
- a backend draws the scene, settling its colors from a style.Look: the svg package writes SVG, and others draw on screens of their own.
Style is not layout: a scene is drawn in any theme, with any overrides, without being laid out again. Only what changes where things are and how large they are is given to layout, in a layout.Options: the measurer and the size of text, the width the host has and whether a diagram may turn to fit it, the padding about it, a grid to snap to, how edges are routed, and the present and the time zone of a gantt chart.
Layout reads a diagram's text and lays it out in one call. A host that lays the same diagram out more than once, as when the width it has changes, parses it once with Parse, which takes the limits and the configuration Pele's parse takes, and lays the Diagram out with its Layout method as often as it needs, from as many goroutines as it likes.
Much of limu is ported from Pele, the Mermaid renderer of the Obsidian team, and its tests compare what limu does with what Pele does, number for number.
Example ¶
package main
import (
"fmt"
"github.com/firede/limu"
"github.com/firede/limu/svg"
)
func main() {
sc, err := limu.Layout("flowchart LR\n A[Text] --> B[Scene] --> C{Backend}\n C -->|svg| D[SVG]\n C -->|limumygo| E[Screen]", nil)
if err != nil {
panic(err)
}
out := svg.Render(sc, nil)
fmt.Println(sc.Type, len(sc.Items), len(out) > 0)
}
Output: flowchart 11 true
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Layout ¶
Layout reads a diagram's text and lays it out as a scene, for a backend to draw: Parse, with the default limits and no configuration of the host's, and then Diagram.Layout. Its errors are theirs.
Types ¶
type Diagram ¶
type Diagram struct {
// contains filtered or unexported fields
}
A Diagram is a diagram's text read into a model, ready to be laid out. Laying it out changes neither its model nor its configuration, so one Diagram may be laid out many times, with other options, and from many goroutines at once: a host that lays a diagram out again when its width changes parses it once.
func Parse ¶
Parse reads a diagram's text, as Pele's parse does: its front matter and directives, its type, and then its body, with the parser of its type. opt holds what Pele's ParseOptions do, the limits the text is held to and the configuration under its own; what changes where things are is given to Layout. Its errors are *diagram.Error: text of no type limu reads, text it cannot parse, or text past a limit. An error that comes once the type is known holds it, as Pele's tagErrors gives it, and so do the errors of Layout.
Example ¶
A host that lays a diagram out again when the width it has changes parses it once.
package main
import (
"fmt"
"github.com/firede/limu"
"github.com/firede/limu/diagram"
"github.com/firede/limu/layout"
)
func main() {
d, err := limu.Parse("pie title Pets\n \"Dogs\": 386\n \"Cats\": 85", diagram.Options{})
if err != nil {
panic(err)
}
for _, width := range []float64{0, 240} {
sc, err := d.Layout(&layout.Options{MaxWidth: width, Padding: new(0.0)})
if err != nil {
panic(err)
}
fmt.Println(d.Type(), sc.Width, sc.Height)
}
}
Output: pie 325 280 pie 240 352
func (*Diagram) Config ¶
Config is the diagram's configuration: its own, over the Options.Config it was parsed with. It is not a copy; a host that changes it must not lay the diagram out meanwhile.
func (*Diagram) Layout ¶
Layout lays the diagram out as a scene, for a backend to draw, with the layout of its type; nil options are the zero Options. It snaps the scene to o.Snap, which the diagram packages' own Layout functions leave to their caller. Its errors are *diagram.Error: one a layout gives, as a sankey diagram's circular link, or one of Code diagram.Limit for a scene that would hold a number that is not finite, as numbers at the edge of what a float64 holds can give, where Pele draws NaN.
func (*Diagram) MermaidType ¶
func (d *Diagram) MermaidType() diagram.MermaidType
MermaidType is the diagram's type as Mermaid names it, as Pele's parse gives it: as "flowchart-v2" for `graph TD`, where Type is "flowchart".
Directories
¶
| Path | Synopsis |
|---|---|
|
Package diagram reads what all Mermaid diagrams share, as Pele's src/preprocess.ts, src/detect.ts and the parse path of src/core.ts do: a diagram's front matter, its directives and comments, and its type.
|
Package diagram reads what all Mermaid diagrams share, as Pele's src/preprocess.ts, src/detect.ts and the parse path of src/core.ts do: a diagram's front matter, its directives and comments, and its type. |
|
agentflow
Package agentflow parses Mermaid's agent flow diagrams, as Pele's src/diagrams/agentflow does: a lexer and a recursive-descent parser that agree with Mermaid's agentflow.jison, the DB they fill, with its metadata, element positions and diagnostics, and the graph that is drawn, with its flows, shapes and palette slots.
|
Package agentflow parses Mermaid's agent flow diagrams, as Pele's src/diagrams/agentflow does: a lexer and a recursive-descent parser that agree with Mermaid's agentflow.jison, the DB they fill, with its metadata, element positions and diagnostics, and the graph that is drawn, with its flows, shapes and palette slots. |
|
architecture
Package architecture parses Mermaid's architecture diagrams and lays them out, as Pele's src/diagrams/architecture does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, the db that checks what the text declares, placeOnGrid, which puts the services, junctions and groups on a grid of cells as the edges' sides ask, and Layout, which sizes the grid's rows and columns and lays the diagram out as a scene.
|
Package architecture parses Mermaid's architecture diagrams and lays them out, as Pele's src/diagrams/architecture does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, the db that checks what the text declares, placeOnGrid, which puts the services, junctions and groups on a grid of cells as the edges' sides ask, and Layout, which sizes the grid's rows and columns and lays the diagram out as a scene. |
|
block
Package block parses Mermaid's block diagrams and lays them out, as Pele's src/diagrams/block does: a lexer and a parser that make the decisions Mermaid's Jison parser makes, the model they fill, Pele's BlockDb, and Layout, which places the blocks in the columns of their composites, draws arrow blocks and the edges between blocks, and gives a scene.
|
Package block parses Mermaid's block diagrams and lays them out, as Pele's src/diagrams/block does: a lexer and a parser that make the decisions Mermaid's Jison parser makes, the model they fill, Pele's BlockDb, and Layout, which places the blocks in the columns of their composites, draws arrow blocks and the edges between blocks, and gives a scene. |
|
c4
Package c4 parses Mermaid's C4 diagrams and lays them out, as Pele's src/diagrams/c4 does: a lexer and a parser that read what Mermaid's c4Diagram.jison reads, the model they build (C4Db), the grid of shapes and boundaries Mermaid lays them out in (layout.ts), the routes of the relations between them (route.ts), and Layout, which draws them as a scene (render.ts).
|
Package c4 parses Mermaid's C4 diagrams and lays them out, as Pele's src/diagrams/c4 does: a lexer and a parser that read what Mermaid's c4Diagram.jison reads, the model they build (C4Db), the grid of shapes and boundaries Mermaid lays them out in (layout.ts), the routes of the relations between them (route.ts), and Layout, which draws them as a scene (render.ts). |
|
class
Package class parses and lays out Mermaid's class diagrams, as Pele's src/diagrams/class does: a lexer and a parser that agree with Mermaid's classDiagram.jison, the DB they fill, buildGraph, which resolves the DB into the nodes and edges that are drawn, and Layout, which lays them out as a scene.
|
Package class parses and lays out Mermaid's class diagrams, as Pele's src/diagrams/class does: a lexer and a parser that agree with Mermaid's classDiagram.jison, the DB they fill, buildGraph, which resolves the DB into the nodes and edges that are drawn, and Layout, which lays them out as a scene. |
|
cynefin
Package cynefin parses Mermaid's Cynefin diagrams and lays them out, as Pele's src/diagrams/cynefin does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildCynefin, which turns the tree into the diagram's model, and Layout, which lays the five domains out as a scene, with the wavy boundaries between them and the transitions from one to another.
|
Package cynefin parses Mermaid's Cynefin diagrams and lays them out, as Pele's src/diagrams/cynefin does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildCynefin, which turns the tree into the diagram's model, and Layout, which lays the five domains out as a scene, with the wavy boundaries between them and the transitions from one to another. |
|
er
Package er parses and lays out Mermaid's entity relationship diagrams, as Pele's src/diagrams/er does: a lexer and a parser that agree with Mermaid's erDiagram.jison, the DB they fill, buildGraph, which resolves the DB into the entities, subgraphs and relationships that are drawn, and Layout, which lays them out as a scene.
|
Package er parses and lays out Mermaid's entity relationship diagrams, as Pele's src/diagrams/er does: a lexer and a parser that agree with Mermaid's erDiagram.jison, the DB they fill, buildGraph, which resolves the DB into the entities, subgraphs and relationships that are drawn, and Layout, which lays them out as a scene. |
|
eventmodeling
Package eventmodeling parses Mermaid's event modeling diagrams and lays them out, as Pele's src/diagrams/eventmodeling does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildEventModel, which sorts the frames into lanes and finds what feeds each, and Layout, which lays the lanes out across, with time running left to right, or the frames down as cards in a narrow host.
|
Package eventmodeling parses Mermaid's event modeling diagrams and lays them out, as Pele's src/diagrams/eventmodeling does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildEventModel, which sorts the frames into lanes and finds what feeds each, and Layout, which lays the lanes out across, with time running left to right, or the frames down as cards in a narrow host. |
|
flowchart
Package flowchart parses Mermaid's flowcharts, as Pele's src/diagrams/flowchart does: a lexer and a recursive-descent parser that agree with Mermaid's flow.jison, the DB they fill, and buildGraph, which resolves the DB into the nodes and edges that are drawn.
|
Package flowchart parses Mermaid's flowcharts, as Pele's src/diagrams/flowchart does: a lexer and a recursive-descent parser that agree with Mermaid's flow.jison, the DB they fill, and buildGraph, which resolves the DB into the nodes and edges that are drawn. |
|
gantt
Package gantt parses Mermaid's gantt charts and lays them out, as Pele's src/diagrams/gantt does: a lexer and a parser that accept what Mermaid's gantt.jison accepts, a DB that schedules the tasks in local time as Mermaid's ganttDb does with dayjs, and Layout, which draws the chart on a time axis as d3 would lay it out.
|
Package gantt parses Mermaid's gantt charts and lays them out, as Pele's src/diagrams/gantt does: a lexer and a parser that accept what Mermaid's gantt.jison accepts, a DB that schedules the tasks in local time as Mermaid's ganttDb does with dayjs, and Layout, which draws the chart on a time axis as d3 would lay it out. |
|
gitgraph
Package gitgraph parses Mermaid's git graphs and lays them out, as Pele's src/diagrams/git does: a lexer and a parser that make the decisions Mermaid's Langium grammar makes, the replay of the statements into a Model of commits and branches, and Layout, which lays the commits out along the lanes of their branches as a scene.
|
Package gitgraph parses Mermaid's git graphs and lays them out, as Pele's src/diagrams/git does: a lexer and a parser that make the decisions Mermaid's Langium grammar makes, the replay of the statements into a Model of commits and branches, and Layout, which lays the commits out along the lanes of their branches as a scene. |
|
info
Package info reads Mermaid's info diagrams and lays them out, as Pele's src/diagrams/info does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildInfo, which makes the model of their tree, and Layout, which draws the renderer's name and version under the title, if there is one.
|
Package info reads Mermaid's info diagrams and lays them out, as Pele's src/diagrams/info does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildInfo, which makes the model of their tree, and Layout, which draws the renderer's name and version under the title, if there is one. |
|
internal/common
Package common holds what the diagrams share beyond layout and drawing, as Pele's diagrams/common does:
|
Package common holds what the diagrams share beyond layout and drawing, as Pele's diagrams/common does: |
|
internal/css
Package css reads what a diagram's author sets in its text with classDef and style lines, in the declarations of CSS they are written in, as Pele's resolveStyle does: the style they give a thing, and the weight, slant and size of its text, which layout takes.
|
Package css reads what a diagram's author sets in its text with classDef and style lines, in the declarations of CSS they are written in, as Pele's resolveStyle does: the style they give a thing, and the weight, slant and size of its text, which layout takes. |
|
internal/draw
Package draw is the geometry of what diagrams draw: the outlines of shapes, the paths of edges, where titles go.
|
Package draw is the geometry of what diagrams draw: the outlines of shapes, the paths of edges, where titles go. |
|
internal/graphs
Package graphs lays out the graphs that more than one diagram places its things with, as Pele's src/layout does in layered.ts, compound.ts and lanes.ts: the layered layout of a flat graph (layered), the compound one of a graph with groups (Compound), and the lanes of a swimlane diagram (Lanes).
|
Package graphs lays out the graphs that more than one diagram places its things with, as Pele's src/layout does in layered.ts, compound.ts and lanes.ts: the layered layout of a flat graph (layered), the compound one of a graph with groups (Compound), and the lanes of a swimlane diagram (Lanes). |
|
ishikawa
Package ishikawa parses Mermaid's Ishikawa (fishbone) diagrams and lays them out, as Pele's src/diagrams/ishikawa does: a lexer and a parser that make the decisions Mermaid's Jison parser makes, the model they fill, Pele's IshikawaDb, which reads the causes as a tree by their indentation, and Layout, which draws the effect at the head of a spine and the causes as bones off it, or, in a narrow host, as an outline that runs down.
|
Package ishikawa parses Mermaid's Ishikawa (fishbone) diagrams and lays them out, as Pele's src/diagrams/ishikawa does: a lexer and a parser that make the decisions Mermaid's Jison parser makes, the model they fill, Pele's IshikawaDb, which reads the causes as a tree by their indentation, and Layout, which draws the effect at the head of a spine and the causes as bones off it, or, in a narrow host, as an outline that runs down. |
|
journey
Package journey parses Mermaid's user journey diagrams and lays them out, as Pele's src/diagrams/journey does: a lexer and a parser that make the decisions Mermaid's Jison grammar makes, the Model they fill, and Layout, which lays a model out as a scene.
|
Package journey parses Mermaid's user journey diagrams and lays them out, as Pele's src/diagrams/journey does: a lexer and a parser that make the decisions Mermaid's Jison grammar makes, the Model they fill, and Layout, which lays a model out as a scene. |
|
kanban
Package kanban reads Mermaid's kanban boards and lays them out, as Pele's src/diagrams/kanban does: an outline of columns, each with its cards, and the cards' metadata of tickets, assignees and priorities.
|
Package kanban reads Mermaid's kanban boards and lays them out, as Pele's src/diagrams/kanban does: an outline of columns, each with its cards, and the cards' metadata of tickets, assignees and priorities. |
|
mindmap
Package mindmap reads Mermaid's mindmaps and lays them out, as Pele's src/diagrams/mindmap does: an indented outline read with the grammar mindmaps share with kanban boards, made into a tree of nodes, and laid out with the first-level branches spread to both sides of the root, or, in a narrow host, as an outline running down.
|
Package mindmap reads Mermaid's mindmaps and lays them out, as Pele's src/diagrams/mindmap does: an indented outline read with the grammar mindmaps share with kanban boards, made into a tree of nodes, and laid out with the first-level branches spread to both sides of the root, or, in a narrow host, as an outline running down. |
|
packet
Package packet parses Mermaid's packet diagrams and lays them out, as Pele's src/diagrams/packet does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildPacket, which splits the fields into rows, and Layout, which lays the rows out as a scene.
|
Package packet parses Mermaid's packet diagrams and lays them out, as Pele's src/diagrams/packet does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildPacket, which splits the fields into rows, and Layout, which lays the rows out as a scene. |
|
pie
Package pie parses Mermaid's pie charts and lays them out, as Pele's src/diagrams/pie does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildPie, which makes the model of their tree, and Layout, which lays out the slices, their percentages and a legend as a scene.
|
Package pie parses Mermaid's pie charts and lays them out, as Pele's src/diagrams/pie does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildPie, which makes the model of their tree, and Layout, which lays out the slices, their percentages and a legend as a scene. |
|
quadrant
Package quadrant parses Mermaid's quadrant charts and lays them out, as Pele's src/diagrams/quadrant does: a lexer and a parser that make the decisions Mermaid's Jison grammar makes, the Model they fill, and Layout, which lays a model out as a scene.
|
Package quadrant parses Mermaid's quadrant charts and lays them out, as Pele's src/diagrams/quadrant does: a lexer and a parser that make the decisions Mermaid's Jison grammar makes, the Model they fill, and Layout, which lays a model out as a scene. |
|
radar
Package radar parses Mermaid's radar charts and lays them out, as Pele's src/diagrams/radar does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildRadar, which puts each curve's values in the order of the axes, and Layout, which lays the chart out as a scene: a graticule, the axes and their labels, a curve for each series, and a legend.
|
Package radar parses Mermaid's radar charts and lays them out, as Pele's src/diagrams/radar does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildRadar, which puts each curve's values in the order of the axes, and Layout, which lays the chart out as a scene: a graticule, the axes and their labels, a curve for each series, and a legend. |
|
railroad
Package railroad parses Mermaid's railroad diagrams and lays them out, as Pele's src/diagrams/railroad does.
|
Package railroad parses Mermaid's railroad diagrams and lays them out, as Pele's src/diagrams/railroad does. |
|
requirement
Package requirement parses and lays out Mermaid's requirement diagrams, as Pele's src/diagrams/requirement does: a lexer and a recursive-descent parser that agree with Mermaid's requirementDiagram.jison, the DB they fill, buildGraph, which resolves the DB into the nodes and edges that are drawn, and Layout, which lays them out as a scene.
|
Package requirement parses and lays out Mermaid's requirement diagrams, as Pele's src/diagrams/requirement does: a lexer and a recursive-descent parser that agree with Mermaid's requirementDiagram.jison, the DB they fill, buildGraph, which resolves the DB into the nodes and edges that are drawn, and Layout, which lays them out as a scene. |
|
sankey
Package sankey parses Mermaid's sankey diagrams and lays them out, as Pele's src/diagrams/sankey does: a lexer and a parser of the CSV that Mermaid's Jison grammar reads, the model they fill, Pele's SankeyDb, and Layout, which places the nodes in columns by their flow and draws the bands between them, with a label beside each node, as a scene.
|
Package sankey parses Mermaid's sankey diagrams and lays them out, as Pele's src/diagrams/sankey does: a lexer and a parser of the CSV that Mermaid's Jison grammar reads, the model they fill, Pele's SankeyDb, and Layout, which places the nodes in columns by their flow and draws the bands between them, with a label beside each node, as a scene. |
|
sequence
Package sequence parses Mermaid's sequence diagrams and lays them out, as Pele's src/diagrams/sequence does: a lexer and a parser that agree with Mermaid's sequenceDiagram.jison, the DB the statements they read are applied to, and Layout, which lays the participants, messages, notes and blocks out as a scene.
|
Package sequence parses Mermaid's sequence diagrams and lays them out, as Pele's src/diagrams/sequence does: a lexer and a parser that agree with Mermaid's sequenceDiagram.jison, the DB the statements they read are applied to, and Layout, which lays the participants, messages, notes and blocks out as a scene. |
|
state
Package state parses Mermaid's state diagrams and lays them out, as Pele's src/diagrams/state does: a lexer and a parser that agree with Mermaid's stateDiagram.jison, the DB they fill, the graph it resolves into, and the layout of that graph as a scene.
|
Package state parses Mermaid's state diagrams and lays them out, as Pele's src/diagrams/state does: a lexer and a parser that agree with Mermaid's stateDiagram.jison, the DB they fill, the graph it resolves into, and the layout of that graph as a scene. |
|
swimlane
Package swimlane lays out Mermaid's swimlane diagrams, as Pele's src/diagrams/swimlane does.
|
Package swimlane lays out Mermaid's swimlane diagrams, as Pele's src/diagrams/swimlane does. |
|
timeline
Package timeline parses Mermaid's timeline diagrams and lays them out, as Pele's src/diagrams/timeline does: a lexer and a parser that make the decisions Mermaid's Jison parser makes, the model they fill, Pele's TimelineDb, and Layout, which lays the periods out along an axis, across or down, as a scene.
|
Package timeline parses Mermaid's timeline diagrams and lays them out, as Pele's src/diagrams/timeline does: a lexer and a parser that make the decisions Mermaid's Jison parser makes, the model they fill, Pele's TimelineDb, and Layout, which lays the periods out along an axis, across or down, as a scene. |
|
treemap
Package treemap parses Mermaid's treemaps and lays them out, as Pele's src/diagrams/treemap does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildTreemap, which nests the rows into a tree by their indentation, and Layout, which lays the tree out as a squarified treemap in a scene.
|
Package treemap parses Mermaid's treemaps and lays them out, as Pele's src/diagrams/treemap does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, buildTreemap, which nests the rows into a tree by their indentation, and Layout, which lays the tree out as a squarified treemap in a scene. |
|
treeview
Package treeview parses Mermaid's tree view diagrams and lays them out, as Pele's src/diagrams/treeview does: a preprocessor that reads a tree drawn with box-drawing characters as one indented, a tokenizer and a parser that read what Mermaid's Langium grammar reads, a database that nests the entries by their indentation, and Layout, which lays the tree out as a scene, a row to an entry.
|
Package treeview parses Mermaid's tree view diagrams and lays them out, as Pele's src/diagrams/treeview does: a preprocessor that reads a tree drawn with box-drawing characters as one indented, a tokenizer and a parser that read what Mermaid's Langium grammar reads, a database that nests the entries by their indentation, and Layout, which lays the tree out as a scene, a row to an entry. |
|
usecase
Package usecase parses Mermaid's use case diagrams and lays them out, as Pele's src/diagrams/usecase does: a lexer and a parser that make the decisions Mermaid's Chevrotain parser makes, the resolution of what they read into a Model, buildGraph, which turns the model into the nodes and edges that are drawn, and Layout, which lays them out as a scene.
|
Package usecase parses Mermaid's use case diagrams and lays them out, as Pele's src/diagrams/usecase does: a lexer and a parser that make the decisions Mermaid's Chevrotain parser makes, the resolution of what they read into a Model, buildGraph, which turns the model into the nodes and edges that are drawn, and Layout, which lays them out as a scene. |
|
venn
Package venn parses Mermaid's venn diagrams and lays them out, as Pele's src/diagrams/venn does: a lexer and a parser that make the decisions Mermaid's Jison grammar makes, the Model they fill, Pele's VennDb, and Layout, which places a circle for each set, with areas in proportion to the sizes of the sets and each pair as far apart as its overlap asks, and writes each region's label and texts where the region has the most room.
|
Package venn parses Mermaid's venn diagrams and lays them out, as Pele's src/diagrams/venn does: a lexer and a parser that make the decisions Mermaid's Jison grammar makes, the Model they fill, Pele's VennDb, and Layout, which places a circle for each set, with areas in proportion to the sizes of the sets and each pair as far apart as its overlap asks, and writes each region's label and texts where the region has the most room. |
|
wardley
Package wardley parses Mermaid's Wardley maps and lays them out, as Pele's src/diagrams/wardley does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, populate and the builder, which turn the tree into the map's model, and Layout, which lays the map out as a scene.
|
Package wardley parses Mermaid's Wardley maps and lays them out, as Pele's src/diagrams/wardley does: a tokenizer and a parser that read what Mermaid's Langium grammar reads, populate and the builder, which turn the tree into the map's model, and Layout, which lays the map out as a scene. |
|
xychart
Package xychart parses Mermaid's XY charts and lays them out, as Pele's src/diagrams/xychart does: a lexer and a parser that make the decisions Mermaid's Jison parser makes, the model they fill, Pele's XyChartDb, and Layout, which lays out the axes, the bars and lines of each series, and a legend, as a scene.
|
Package xychart parses Mermaid's XY charts and lays them out, as Pele's src/diagrams/xychart does: a lexer and a parser that make the decisions Mermaid's Jison parser makes, the model they fill, Pele's XyChartDb, and Layout, which lays out the axes, the bars and lines of each series, and a legend, as a scene. |
|
internal
|
|
|
chars
Package chars reads text the way the JavaScript that limu's parsers are ported from reads it: by UTF-16 code units, with JavaScript's white space, its trim and toLowerCase, and its conversions between numbers and strings.
|
Package chars reads text the way the JavaScript that limu's parsers are ported from reads it: by UTF-16 code units, with JavaScript's white space, its trim and toLowerCase, and its conversions between numbers and strings. |
|
fixture
Package fixture reads the fixtures internal/oracle writes from Pele: JSON, gzipped, beside where the tests name them, and the numbers in them as the oracle writes them.
|
Package fixture reads the fixtures internal/oracle writes from Pele: JSON, gzipped, beside where the tests name them, and the numbers in them as the oracle writes them. |
|
gallery
Package gallery holds limu's examples, which the website and the playground show: for each type of diagram limu reads but info, which only shows a version number, its title, a description, and its examples.
|
Package gallery holds limu's examples, which the website and the playground show: for each type of diagram limu reads but info, which only shows a version number, its title, a description, and its examples. |
|
gallery/preview
command
Command preview draws the examples of the types it is given as one HTML page, to look at while writing them: each example's title and source, and its diagram laid out at most 640, 480 and 320 wide, as the website draws it, at its own size, in Kohu or, with -dark, in KohuDark.
|
Command preview draws the examples of the types it is given as one HTML page, to look at while writing them: each example's title and source, and its diagram laid out at most 640, 480 and 320 wide, as the website draws it, at its own size, in Kohu or, with -dark, in KohuDark. |
|
jsdate
Package jsdate is JavaScript's Date as V8 works it out, for code ported from Pele that computes with dates in local time: the arithmetic of its constructor, getters and setters, Date.UTC, and the parser of new Date(string).
|
Package jsdate is JavaScript's Date as V8 works it out, for code ported from Pele that computes with dates in local time: the arithmetic of its constructor, getters and setters, Date.UTC, and the parser of new Date(string). |
|
jsjson
Package jsjson is JavaScript's JSON.parse and JSON.stringify, as V8 has them, for the diagrams whose text holds JSON: the values JSON.parse gives, with an object's keys in the order JavaScript iterates them, and the messages of the errors V8 throws.
|
Package jsjson is JavaScript's JSON.parse and JSON.stringify, as V8 has them, for the diagrams whose text holds JSON: the values JSON.parse gives, with an object's keys in the order JavaScript iterates them, and the messages of the errors V8 throws. |
|
jsmath
Package jsmath is the arithmetic of JavaScript where Go's differs from it, for code ported from Pele that must come out as Pele's does to the last bit.
|
Package jsmath is the arithmetic of JavaScript where Go's differs from it, for code ported from Pele that must come out as Pele's does to the last bit. |
|
pelesvg
Package pelesvg writes numbers and paths as Pele's SVG writes them, for tests that compare with what it draws.
|
Package pelesvg writes numbers and paths as Pele's SVG writes them, for tests that compare with what it draws. |
|
url
Package url checks the URLs Mermaid diagrams link to and show, as Pele's src/util/url.ts does: sanitizeUrl follows @braintree/sanitize-url, which Mermaid applies to click targets, and LinkURL and ImageURL keep a URL only where the host allows its scheme.
|
Package url checks the URLs Mermaid diagrams link to and show, as Pele's src/util/url.ts does: sanitizeUrl follows @braintree/sanitize-url, which Mermaid applies to click targets, and LinkURL and ImageURL keep a URL only where the host allows its scheme. |
|
yaml
Package yaml reads the YAML Mermaid diagrams carry, in their front matter and in the metadata of flowchart nodes, as Pele's src/util/yaml.ts reads it: a small reader that agrees with js-yaml and its JSON schema on what Mermaid feeds it, with block and flow collections, quoted and plain scalars, and block scalars.
|
Package yaml reads the YAML Mermaid diagrams carry, in their front matter and in the metadata of flowchart nodes, as Pele's src/util/yaml.ts reads it: a small reader that agrees with js-yaml and its JSON schema on what Mermaid feeds it, with block and flow collections, quoted and plain scalars, and block scalars. |
|
Package layout holds the options that change where things are: the measurer and the size of text, the width the host has, a grid to snap to, how edges are routed, and the like.
|
Package layout holds the options that change where things are: the measurer and the size of text, the width the host has, a grid to snap to, how edges are routed, and the like. |
|
limumygo
module
|
|
|
Package scene is a diagram laid out: a list of items, each a thing of the diagram, where it is and what it is, in the order they are drawn — but not how they look.
|
Package scene is a diagram laid out: a list of items, each a thing of the diagram, where it is and what it is, in the order they are drawn — but not how they look. |
|
Package style says how a diagram looks, at three levels.
|
Package style says how a diagram looks, at three levels. |
|
Package svg draws a scene as SVG.
|
Package svg draws a scene as SVG. |