Closed moollaza closed 8 years ago
@moollaza just to be clear when you mean a literal "\n", do you mean displaying "\n" or displaying "↵"?
Is it basically the same as how JSON.parse() would work (can I use that as a guide) or different than this:
and
Also - for literals in general - is this line correct?
To express a backslash, use a quadruple backslash:
\\\\
just to be clear when you mean a literal "\n", do you mean displaying "\n" or displaying "↵"?
I mean displaying the text: \n
on the page like we do here: https://duckduckgo.com/?q=common+escape+sequences+cheat+sheet&ia=cheatsheet&iax=1
So, it's kinda different from JSON.parse()
-- we're not using that FWIW.
Also - for literals in general - is this line correct?
To express a backslash, use a quadruple backslash:
\\\\
Uh right now you need to use \\\\
to get a \
showing on the SERP, but that's actually kind of a bug. You should really only need \\
. We can adjust the CheatSheet parser to better handle \\
.
\\\\
when parsed as JSON becomes \\
which to our parser is an escaped \
.
Btw - was playing in codio - is this the right usage of \n
? I didn't get a line break, and just ran duckpan upgrade
before it
(didn't work for code template or keyboard template either)
Cheat Sheets now support newlines and tabs (useful for code blocks).
\n
in the JSON will be converted to a<br>
in the generated HTML\t
in the JSON will be converted to
in the generated HTMLIf you want to show a literal
\n
or\t
in your JSON, you need to escape the slash:\\n
or\\t
E.g. https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/share/goodie/cheat_sheets/json/common-escape-sequences.json#L48