diff --git a/d2exporter/export.go b/d2exporter/export.go index 4cbd6ae601..42b20a5c69 100644 --- a/d2exporter/export.go +++ b/d2exporter/export.go @@ -144,6 +144,7 @@ func toShape(obj *d2graph.Object, g *d2graph.Graph) d2target.Shape { shape.Pos = d2target.NewPoint(int(obj.TopLeft.X), int(obj.TopLeft.Y)) shape.Width = int(obj.Width) shape.Height = int(obj.Height) + shape.Language = obj.Language text := obj.Text() shape.Bold = text.IsBold @@ -165,9 +166,6 @@ func toShape(obj *d2graph.Object, g *d2graph.Graph) d2target.Shape { applyStyles(shape, obj) switch strings.ToLower(obj.Shape.Value) { - case d2target.ShapeCode, d2target.ShapeText: - shape.Language = obj.Language - shape.Label = obj.Label.Value case d2target.ShapeClass: shape.Class = *obj.Class // The label is the header for classes and tables, which is set in client to be 4 px larger than the object's set font size @@ -179,10 +177,6 @@ func toShape(obj *d2graph.Object, g *d2graph.Graph) d2target.Shape { if obj.ContentAspectRatio != nil { shape.ContentAspectRatio = go2.Pointer(*obj.ContentAspectRatio) } - case d2target.ShapePage: - if obj.IsSequenceDiagramNote() { - shape.Language = obj.Language - } } shape.Label = text.Text shape.LabelWidth = text.Dimensions.Width diff --git a/d2graph/d2graph.go b/d2graph/d2graph.go index 6a141b0027..b4a9f594a3 100644 --- a/d2graph/d2graph.go +++ b/d2graph/d2graph.go @@ -582,7 +582,8 @@ func (obj *Object) GetFill() string { func (obj *Object) GetStroke(dashGapSize interface{}) string { shape := obj.Shape.Value - if obj.Language != "" { + if strings.EqualFold(shape, d2target.ShapeCode) || + strings.EqualFold(shape, d2target.ShapeText) { return color.N1 } if strings.EqualFold(shape, d2target.ShapeClass) || @@ -936,7 +937,9 @@ func (obj *Object) GetLabelSize(mtexts []*d2target.MText, ruler *textmeasure.Rul var dims *d2target.TextDimensions switch shapeType { - case d2target.ShapeText: + case d2target.ShapeClass: + dims = GetTextDimensions(mtexts, ruler, obj.Text(), go2.Pointer(d2fonts.SourceCodePro)) + default: if obj.Language == "latex" { width, height, err := d2latex.Measure(obj.Text().Text) if err != nil { @@ -952,12 +955,6 @@ func (obj *Object) GetLabelSize(mtexts []*d2target.MText, ruler *textmeasure.Rul } else { dims = GetTextDimensions(mtexts, ruler, obj.Text(), fontFamily) } - - case d2target.ShapeClass: - dims = GetTextDimensions(mtexts, ruler, obj.Text(), go2.Pointer(d2fonts.SourceCodePro)) - - default: - dims = GetTextDimensions(mtexts, ruler, obj.Text(), fontFamily) } if shapeType == d2target.ShapeSQLTable && obj.Label.Value == "" { diff --git a/e2etests/testdata/txtar/md-label/dagre/board.exp.json b/e2etests/testdata/txtar/md-label/dagre/board.exp.json new file mode 100644 index 0000000000..ca5395c76b --- /dev/null +++ b/e2etests/testdata/txtar/md-label/dagre/board.exp.json @@ -0,0 +1,746 @@ +{ + "name": "", + "isFolderOnly": false, + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "rectangle", + "type": "rectangle", + "pos": { + "x": 0, + "y": 68 + }, + "width": 116, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "square", + "type": "rectangle", + "pos": { + "x": 176, + "y": 68 + }, + "width": 176, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "page", + "type": "page", + "pos": { + "x": 412, + "y": 58 + }, + "width": 116, + "height": 197, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AB4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "parallelogram", + "type": "parallelogram", + "pos": { + "x": 588, + "y": 68 + }, + "width": 168, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "document", + "type": "document", + "pos": { + "x": 816, + "y": 44 + }, + "width": 116, + "height": 224, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AB4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "cylinder", + "type": "cylinder", + "pos": { + "x": 992, + "y": 42 + }, + "width": 116, + "height": 228, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AA4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "queue", + "type": "queue", + "pos": { + "x": 1168, + "y": 68 + }, + "width": 168, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "package", + "type": "package", + "pos": { + "x": 1396, + "y": 51 + }, + "width": 116, + "height": 210, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AA4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "step", + "type": "step", + "pos": { + "x": 1572, + "y": 51 + }, + "width": 156, + "height": 211, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AB4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "callout", + "type": "callout", + "pos": { + "x": 1788, + "y": 56 + }, + "width": 116, + "height": 201, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N7", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "stored_data", + "type": "stored_data", + "pos": { + "x": 1964, + "y": 68 + }, + "width": 136, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AA4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "person", + "type": "person", + "pos": { + "x": 2160, + "y": 68 + }, + "width": 117, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B3", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "OUTSIDE_BOTTOM_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "diamond", + "type": "diamond", + "pos": { + "x": 2337, + "y": 0 + }, + "width": 172, + "height": 312, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "oval", + "type": "oval", + "pos": { + "x": 2569, + "y": 35 + }, + "width": 136, + "height": 242, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "circle", + "type": "oval", + "pos": { + "x": 2765, + "y": 40 + }, + "width": 233, + "height": 233, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "hexagon", + "type": "hexagon", + "pos": { + "x": 3058, + "y": 39 + }, + "width": 144, + "height": 234, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "cloud", + "type": "cloud", + "pos": { + "x": 3262, + "y": 61 + }, + "width": 212, + "height": 191, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N7", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "contentAspectRatio": 0.3741391678622669, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [], + "root": { + "id": "", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 0, + "height": 0, + "opacity": 0, + "strokeDash": 0, + "strokeWidth": 0, + "borderRadius": 0, + "fill": "N7", + "stroke": "", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 0 + } +} diff --git a/e2etests/testdata/txtar/md-label/dagre/sketch.exp.svg b/e2etests/testdata/txtar/md-label/dagre/sketch.exp.svg new file mode 100644 index 0000000000..53ab94c0a2 --- /dev/null +++ b/e2etests/testdata/txtar/md-label/dagre/sketch.exp.svg @@ -0,0 +1,936 @@ +

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+
+ + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/e2etests/testdata/txtar/md-label/elk/board.exp.json b/e2etests/testdata/txtar/md-label/elk/board.exp.json new file mode 100644 index 0000000000..79cc92a575 --- /dev/null +++ b/e2etests/testdata/txtar/md-label/elk/board.exp.json @@ -0,0 +1,746 @@ +{ + "name": "", + "isFolderOnly": false, + "fontFamily": "SourceSansPro", + "shapes": [ + { + "id": "rectangle", + "type": "rectangle", + "pos": { + "x": 12, + "y": 80 + }, + "width": 116, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "square", + "type": "rectangle", + "pos": { + "x": 148, + "y": 80 + }, + "width": 176, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "page", + "type": "page", + "pos": { + "x": 344, + "y": 69 + }, + "width": 116, + "height": 197, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AB4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "parallelogram", + "type": "parallelogram", + "pos": { + "x": 480, + "y": 80 + }, + "width": 168, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "document", + "type": "document", + "pos": { + "x": 668, + "y": 56 + }, + "width": 116, + "height": 224, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AB4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "cylinder", + "type": "cylinder", + "pos": { + "x": 804, + "y": 54 + }, + "width": 116, + "height": 228, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AA4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "queue", + "type": "queue", + "pos": { + "x": 940, + "y": 80 + }, + "width": 168, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "package", + "type": "package", + "pos": { + "x": 1128, + "y": 63 + }, + "width": 116, + "height": 210, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AA4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "step", + "type": "step", + "pos": { + "x": 1264, + "y": 62 + }, + "width": 156, + "height": 211, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AB4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "callout", + "type": "callout", + "pos": { + "x": 1440, + "y": 67 + }, + "width": 116, + "height": 201, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N7", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "stored_data", + "type": "stored_data", + "pos": { + "x": 1576, + "y": 80 + }, + "width": 136, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "AA4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "person", + "type": "person", + "pos": { + "x": 1732, + "y": 12 + }, + "width": 117, + "height": 176, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B3", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "OUTSIDE_BOTTOM_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "diamond", + "type": "diamond", + "pos": { + "x": 1869, + "y": 12 + }, + "width": 172, + "height": 312, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N4", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "oval", + "type": "oval", + "pos": { + "x": 2061, + "y": 47 + }, + "width": 136, + "height": 242, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "circle", + "type": "oval", + "pos": { + "x": 2217, + "y": 51 + }, + "width": 233, + "height": 233, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "B6", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "hexagon", + "type": "hexagon", + "pos": { + "x": 2470, + "y": 51 + }, + "width": 144, + "height": 234, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N5", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + }, + { + "id": "cloud", + "type": "cloud", + "pos": { + "x": 2634, + "y": 72 + }, + "width": 212, + "height": 191, + "opacity": 1, + "strokeDash": 0, + "strokeWidth": 2, + "borderRadius": 0, + "fill": "N7", + "stroke": "B1", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "contentAspectRatio": 0.3741391678622669, + "label": "# hello\n\n- world\n\nblah blah", + "fontSize": 16, + "fontFamily": "DEFAULT", + "language": "markdown", + "color": "N1", + "italic": false, + "bold": true, + "underline": false, + "labelWidth": 71, + "labelHeight": 131, + "labelPosition": "INSIDE_MIDDLE_CENTER", + "zIndex": 0, + "level": 1 + } + ], + "connections": [], + "root": { + "id": "", + "type": "", + "pos": { + "x": 0, + "y": 0 + }, + "width": 0, + "height": 0, + "opacity": 0, + "strokeDash": 0, + "strokeWidth": 0, + "borderRadius": 0, + "fill": "N7", + "stroke": "", + "shadow": false, + "3d": false, + "multiple": false, + "double-border": false, + "tooltip": "", + "link": "", + "icon": null, + "iconPosition": "", + "blend": false, + "fields": null, + "methods": null, + "columns": null, + "label": "", + "fontSize": 0, + "fontFamily": "", + "language": "", + "color": "", + "italic": false, + "bold": false, + "underline": false, + "labelWidth": 0, + "labelHeight": 0, + "zIndex": 0, + "level": 0 + } +} diff --git a/e2etests/testdata/txtar/md-label/elk/sketch.exp.svg b/e2etests/testdata/txtar/md-label/elk/sketch.exp.svg new file mode 100644 index 0000000000..0e7aef9977 --- /dev/null +++ b/e2etests/testdata/txtar/md-label/elk/sketch.exp.svg @@ -0,0 +1,936 @@ +

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+

hello

+
    +
  • world
  • +
+

blah blah

+
+ + + + + + + + + + + + + + + + + + +
\ No newline at end of file diff --git a/e2etests/testdata/txtar/sequence-diagram-note-md/dagre/board.exp.json b/e2etests/testdata/txtar/sequence-diagram-note-md/dagre/board.exp.json index 1587ed8360..4ed4a2f6e6 100644 --- a/e2etests/testdata/txtar/sequence-diagram-note-md/dagre/board.exp.json +++ b/e2etests/testdata/txtar/sequence-diagram-note-md/dagre/board.exp.json @@ -99,7 +99,7 @@ "strokeWidth": 2, "borderRadius": 0, "fill": "N7", - "stroke": "N1", + "stroke": "B1", "shadow": false, "3d": false, "multiple": false, @@ -140,7 +140,7 @@ "strokeWidth": 2, "borderRadius": 0, "fill": "N7", - "stroke": "N1", + "stroke": "B1", "shadow": false, "3d": false, "multiple": false, @@ -171,17 +171,17 @@ "id": "x.z", "type": "page", "pos": { - "x": 10, + "x": 27, "y": 558 }, - "width": 103, - "height": 37, + "width": 69, + "height": 40, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, "borderRadius": 0, "fill": "N7", - "stroke": "N1", + "stroke": "B1", "shadow": false, "3d": false, "multiple": false, @@ -202,8 +202,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 87, - "labelHeight": 21, + "labelWidth": 53, + "labelHeight": 24, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 5, "level": 2 @@ -278,7 +278,7 @@ }, { "x": 62, - "y": 665 + "y": 668 } ], "animated": false, @@ -316,7 +316,7 @@ }, { "x": 292, - "y": 665 + "y": 668 } ], "animated": false, diff --git a/e2etests/testdata/txtar/sequence-diagram-note-md/dagre/sketch.exp.svg b/e2etests/testdata/txtar/sequence-diagram-note-md/dagre/sketch.exp.svg index d878978424..dfd8ff0d80 100644 --- a/e2etests/testdata/txtar/sequence-diagram-note-md/dagre/sketch.exp.svg +++ b/e2etests/testdata/txtar/sequence-diagram-note-md/dagre/sketch.exp.svg @@ -1,34 +1,34 @@ -xy hello

A man who fishes for marlin in ponds

+xy hello

A man who fishes for marlin in ponds

  • ...dramatic pause

will put his money in Etruscan bonds.

-
1 + 1 = 21 + 1 = 2 - +
1 + 1 = 21 + 1 = 2 + - +
\ No newline at end of file diff --git a/e2etests/testdata/txtar/sequence-diagram-note-md/elk/board.exp.json b/e2etests/testdata/txtar/sequence-diagram-note-md/elk/board.exp.json index 1587ed8360..4ed4a2f6e6 100644 --- a/e2etests/testdata/txtar/sequence-diagram-note-md/elk/board.exp.json +++ b/e2etests/testdata/txtar/sequence-diagram-note-md/elk/board.exp.json @@ -99,7 +99,7 @@ "strokeWidth": 2, "borderRadius": 0, "fill": "N7", - "stroke": "N1", + "stroke": "B1", "shadow": false, "3d": false, "multiple": false, @@ -140,7 +140,7 @@ "strokeWidth": 2, "borderRadius": 0, "fill": "N7", - "stroke": "N1", + "stroke": "B1", "shadow": false, "3d": false, "multiple": false, @@ -171,17 +171,17 @@ "id": "x.z", "type": "page", "pos": { - "x": 10, + "x": 27, "y": 558 }, - "width": 103, - "height": 37, + "width": 69, + "height": 40, "opacity": 1, "strokeDash": 0, "strokeWidth": 2, "borderRadius": 0, "fill": "N7", - "stroke": "N1", + "stroke": "B1", "shadow": false, "3d": false, "multiple": false, @@ -202,8 +202,8 @@ "italic": false, "bold": false, "underline": false, - "labelWidth": 87, - "labelHeight": 21, + "labelWidth": 53, + "labelHeight": 24, "labelPosition": "INSIDE_MIDDLE_CENTER", "zIndex": 5, "level": 2 @@ -278,7 +278,7 @@ }, { "x": 62, - "y": 665 + "y": 668 } ], "animated": false, @@ -316,7 +316,7 @@ }, { "x": 292, - "y": 665 + "y": 668 } ], "animated": false, diff --git a/e2etests/testdata/txtar/sequence-diagram-note-md/elk/sketch.exp.svg b/e2etests/testdata/txtar/sequence-diagram-note-md/elk/sketch.exp.svg index d878978424..dfd8ff0d80 100644 --- a/e2etests/testdata/txtar/sequence-diagram-note-md/elk/sketch.exp.svg +++ b/e2etests/testdata/txtar/sequence-diagram-note-md/elk/sketch.exp.svg @@ -1,34 +1,34 @@ -xy hello

A man who fishes for marlin in ponds

+xy hello

A man who fishes for marlin in ponds

  • ...dramatic pause

will put his money in Etruscan bonds.

-
1 + 1 = 21 + 1 = 2 - +
1 + 1 = 21 + 1 = 2 + - +
\ No newline at end of file diff --git a/e2etests/txtar.txt b/e2etests/txtar.txt index c02d25bdc6..761d02d40b 100644 --- a/e2etests/txtar.txt +++ b/e2etests/txtar.txt @@ -491,3 +491,156 @@ x.z: |python 1 + 1 = 2 | +-- md-label -- +rectangle.shape: rectangle +rectangle: |md + # hello + + - world + + blah blah +| + +square.shape: square +square: |md + # hello + + - world + + blah blah +| + +page.shape: page +page: |md + # hello + + - world + + blah blah +| + +parallelogram.shape: parallelogram +parallelogram: |md + # hello + + - world + + blah blah +| + +document.shape: document +document: |md + # hello + + - world + + blah blah +| + +cylinder.shape: cylinder +cylinder: |md + # hello + + - world + + blah blah +| + +queue.shape: queue +queue: |md + # hello + + - world + + blah blah +| + +package.shape: package +package: |md + # hello + + - world + + blah blah +| + +step.shape: step +step: |md + # hello + + - world + + blah blah +| + +callout.shape: callout +callout: |md + # hello + + - world + + blah blah +| + +stored_data.shape: stored_data +stored_data: |md + # hello + + - world + + blah blah +| + +person.shape: person +person: |md + # hello + + - world + + blah blah +| + +diamond.shape: diamond +diamond: |md + # hello + + - world + + blah blah +| + +oval.shape: oval +oval: |md + # hello + + - world + + blah blah +| + +circle.shape: circle +circle: |md + # hello + + - world + + blah blah +| + +hexagon.shape: hexagon +hexagon: |md + # hello + + - world + + blah blah +| + +cloud.shape: cloud +cloud: |md + # hello + + - world + + blah blah +|