The problem is exhibited and explained at https://observablehq.com/d/5ec9470132a7b916.
I have enabled link sharing on that notebook, but have not published it.
Please let me know if that’s sufficient for everyone to view it.
Thanks.
The problem is exhibited and explained at https://observablehq.com/d/5ec9470132a7b916.
I have enabled link sharing on that notebook, but have not published it.
Please let me know if that’s sufficient for everyone to view it.
Thanks.
This is expected behavior, since in Observable, we don’t write markdown directly, but instead write Javascript that uses the md
tag function on a template literal in which you must “escape” backslashes. Github processes markdown directly, so you don’t have to escape any characters there.
When I don’t feel like escaping a bunch of backslashes by hand I sometimes use String.raw
like this:
md`${String.raw` The file platform\windows\tools\unzipsfx\unzipsfx.zip contains ...`}`
For what it’s worth, we use String.raw internally for the tex
template literals, since backslashes are so common in LaTeX. But we elected not to do that for Markdown (md
), HTML (html
) and SVG (svg
) template literals so that you can use normal JavaScript string escapes, such as \u2764 for Unicode ().
Thanks for the explanation and the solution @bgchen.
Good to know the reasoning too @mbostock
Thanks all.
I wonder if it might make sense to add md.raw
, html.raw
etc. template literals.
(On the other hand, I’m not sure how common this need is; I’ve never had any templates (except LaTeX) that needed enough backslashes to care very much.)