Interestingly this only happens once a notebook is published/link shared. It works as expected when a notebook is private. (To see this in action, fork the notebook and see a chess pawn appear).
I tested this in the latest Chrome and Firefox. Haven’t tried other browsers.
(You could use #white-pawn here instead in Chrome and Firefox, but sadly Safari has another bug where anchor fragments are not resolved correctly when the page has a <base href> element.)
@mbostock This is maybe a separate question, but unfortunately that approach is causing me some trouble on the notebook I’m actually trying to do this in because I’m using hypertext literal which is auto-escaping that SVG code. Is there any way to disable autoescaping in htl or an elegant workaround?
There are a variety of ways to interpret text as markup (rather than text). One way would be to invoke html or svg as a function, passing in a dynamic string:
I suspect it’s because my SVG code is malformed. viewBox is case sensitive but in my file I have viewbox. Maybe the latter approach is using some sort of lenient parsing that corrects the capitalization? I spent a while wrestling with that last night before I figured it out. It was all the more confusing because I tried to edit it in the developer tools while sleuthing around, but the developer tools also silently corrected the capitalization when I edited it and I didn’t notice for quite a while