Multiline strings

In Introduction to Data / Observable / Observable the only recommended way for inlining multiline string is by using template literals which is not possible for certain input.


Here is the text version
main -> "#nexus\n" block
# TODO - block_name and block_content should match
block -> "begin" _ block_name ";\n" block_content "end;" _
block_name -> "trees"
block_content -> _ "tree one = " newick "\n"
newick -> newick_name ";" # | [^]:+
newick_name -> [-/a-zA-Z0-9]:+ 

# [^]:+ - is the same as .:+ but matches newlines
#         and is equivalent to .+ in regexps

# whitespace matcher that returns nothing
_ -> [\s]:*     {% function(d) {return null } %}

What is the recommended way to have such data that is incompatible with templates, inline in Observable notebooks?

Interesting, I don’t see that error. Also, you can use String.raw: Multiline String / Yuri Vishnevsky / Observable

1 Like

It appeared I’ve had a ' at the end of the string literal instead of the `. So the issue is solved for now, because my content in the end doesn’t contain any invalid template placeholders. And if it will, I try String.raw. Thanks.

EDIT: Confirmed line = String.raw`what\never` works as expected.

1 Like