Comments (14)
I am on Linux (kernel 6.0) Just tested with firefox and chrome. It works indeed but fails with Inkscape, and applications that render svg with librsvg. Looking at the XML code, I notice that the Title text is implemented as svg:foreignObject
rather than a standard text object https://developer.mozilla.org/en-US/docs/Web/SVG/Element/text
from tala.
@uliw hmm yes, some of the lengths are unnecessarily long. We'll look into this, ty for reporting. @ejulio-ts
from tala.
@uliw this one was fixed and should be available in TALA's next release
from tala.
Thanks! BTW, is there a way to affect the ordering (I.e., Surface on top)?
from tala.
you might set
surface: {
near: top
}
https://d2lang.com/tour/text#near-a-constant
from tala.
hmmh, neither this nor the example https://d2lang.com/tour/text#near-a-constant will work. d2 version is v0.1.3, I updated to tala 0.2.10 but I am not sure how to verify the version.
running
title: |md
# A winning strategy
| { near: top-center }
poll the people -> results
results -> unfavorable -> poll the people
results -> favorable -> will of the people
will compile wo errors, but no title text is shown
Using the near: top
complains that top is invalid. Replacing this with top-center
results in the following error when I add it to the code above
err: failed to compile: exit status 2
err: stderr:
err: panic: runtime error: invalid memory address or nil pointer dereference
err: [signal SIGSEGV: segmentation violation code=0x1 addr=0x30 pc=0xdcafae]
err:
err: goroutine 35 [running]:
err: github.com/terrastruct/src/backend/tala.(*Node).addEdge(...)
err: github.com/terrastruct/src/backend/tala/node.go:848
err: github.com/terrastruct/src/backend/tala.(*Graph).Connect(...)
err: github.com/terrastruct/src/backend/tala/graph.go:397
err: github.com/terrastruct/src/backend/tala/transpilers/d2transpiler.PopulateNodes({0xdcfb92?, 0x1a46d40?}, 0xc00065c000, 0xc000013d40)
err: github.com/terrastruct/src/backend/tala/transpilers/d2transpiler/d2transpiler.go:91 +0x62e
err: github.com/terrastruct/src/backend/tala/transpilers/d2transpiler.Layout({0x1a4d550, 0xc000d42000}, 0xc000117e50?)
err: github.com/terrastruct/src/backend/tala/transpilers/d2transpiler/d2transpiler.go:128 +0x25d
err: main.talaPlugin.Layout({0xc000658000?}, {0x1a4d550, 0xc000d42000}, 0xc00065c000?)
err: github.com/terrastruct/src/backend/tala/cmd/d2plugin-tala/plugin_tala.go:102 +0xda
err: oss.terrastruct.com/d2/d2plugin.layout({0x1a4d550, 0xc000d42000}, {0x1a4d340, 0xc00094fd70}, 0xc0001a1560)
err: oss.terrastruct.com/[email protected]/d2plugin/serve.go:76 +0xb5
err: oss.terrastruct.com/d2/d2plugin.Serve.func1({0x1a4d550, 0xc000d42000}, 0xc0001a1560)
err: oss.terrastruct.com/[email protected]/d2plugin/serve.go:42 +0x1f2
err: oss.terrastruct.com/util-go/xmain.(*State).Main.func1()
err: oss.terrastruct.com/[email protected]/xmain/xmain.go:91 +0x71
err: created by oss.terrastruct.com/util-go/xmain.(*State).Main
err: oss.terrastruct.com/[email protected]/xmain/xmain.go:89 +0x155
from tala.
🤔
We just released TALA v.0.2.11, can you test with it?
here is the playground version, so it should be working
from tala.
@uliw you can check TALA's version with d2plugin-tala --version
from tala.
d2 version = 0.1.4
d2plugin-tala --version = v0.2.11
running
title: |md
# A winning strategy
| { near: top-center }
poll the people -> results
results -> unfavorable -> poll the people
results -> favorable -> will of the people
results in a figure that is missing the title. Using the same code on the playground site shows the title. I did a complete re-install but the result is the same
from tala.
Here is the result of a fresh install
and here is the PNG result d2 --layout=tala test.d2 test.png
from tala.
ok, so probably has something to do with my local environment. I did the test again and can confirm that the SVG file is still missing the title. Exporting to PNG, however, renders the title as expected. So probably related to the SVG rendering. Opening the file with Inkscape results in the same result (i.e. no title). Using the XML editor in Inkscape, I am able to find the Title text, but it will not show (nor can you select it). I've attached ggg.svg which is the output as produced by d2, and ggg_2.svg which is the same file, but I deleted most elements.
from tala.
interesting 🤔
What OS are you using?
What browser?
Just in case, the SVG you attached rendered as expected here on GH for me
from tala.
this is an issue on how D2 renders the SVG then.
I opened an issue there to continue the discussion and find out why we ue foreignObject
instead of text
terrastruct/d2#596
thanks for helping to debug this one :)
from tala.
@uliw Markdown is compiled to HTML, which has to be in a foreignobject. if foreign objects are a nonstarter for the format you're viewing the SVGs in, you can use plain text.
from tala.
Related Issues (20)
- all else equal, prefer lining up opposite side connections HOT 1
- manual: Add instructions to test everything is working
- routing for grid edges
- direction on edges HOT 1
- Include grid edges in manual
- `shape: hierarchy` to force hierarchy
- failed to verify $TSTRUCT_TOKEN: illegal base64 data at input byte 5 HOT 4
- explain perpetual fallback license more
- allow `width`/`height` to be set on root
- tala layout could be more symmetrical in comparison to elk for this scenario
- edges labels should prefer intersecting nodes than other edges
- Unexpected behavior when using `grid-column`
- failed to compile: plugin has routing feature but does not implement RoutingPlugin HOT 3
- Please don't recommend to use this layout engine if it's not a one-line install... HOT 1
- manual: mention routing grid edges
- label should automatically move away from icons
- rearrange edges to prefer sorting by appearance
- Tala error with connection between two sequence diagrams HOT 1
- when token expires and used as environment variable, attempt refresh and print to tty
- edges can go through `opacity: 0` objects HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tala.