You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found that one must be very careful to inspect their code and replace \n with \\n, otherwise it will be converted to an actual newline in the rendered output. Similarly, \t must be replaced with \\t, and so on. Backticks-in-code must also be escaped. Doing that is tricky and error-prone. Ideally, one could just copy some raw code from their IDE/text editor straight into their .astro file, somewhere, and be done.
Good news: it's possible, and here's how... just append String.raw before the first backtick. That way everything inside the backticks will be interepreted as a raw string.
The above example code, in the docs, would become:
The docs about the Code component give examples of how you could use it in an Astro file (.astro):
I found that one must be very careful to inspect their code and replace
\n
with\\n
, otherwise it will be converted to an actual newline in the rendered output. Similarly,\t
must be replaced with\\t
, and so on. Backticks-in-code must also be escaped. Doing that is tricky and error-prone. Ideally, one could just copy some raw code from their IDE/text editor straight into their .astro file, somewhere, and be done.Good news: it's possible, and here's how... just append
String.raw
before the first backtick. That way everything inside the backticks will be interepreted as a raw string.The above example code, in the docs, would become:
The text was updated successfully, but these errors were encountered: