unison/unison-src/transcripts/text-literals.output.md
Greg Pfeil 0031542faf
Add a space before code block info strings
This is for consistency with the `cmark` style. Now the blocks we still
pretty-print ourselves will match the bulk of them that `cmark`
produces.
2024-07-10 13:56:07 -06:00

3.2 KiB

This transcript shows some syntax for raw text literals.

lit1 = """
This is a raw text literal.
It can start with 3 or more ",
and is terminated by the same number of quotes.
Nothing is escaped. \n

The initial newline, if it exists, is ignored.
The last line, if it's just whitespace up to the closing quotes,
is ignored.

Use an extra blank line if you'd like a trailing newline. Like so:

"""

> lit1
> Some lit1

lit2 = """"
    This is a raw text literal, indented.
    It can start with 3 or more ",
    and is terminated by the same number of quotes.
    Nothing is escaped. \n

    This doesn't terminate the literal - """
    """"

> lit2
> Some lit2

  Loading changes detected in scratch.u.

  I found and typechecked these definitions in scratch.u. If you
  do an `add` or `update`, here's how your codebase would
  change:
  
    ⍟ These new definitions are ok to `add`:
    
      lit1 : Text
      lit2 : Text
  
  Now evaluating any watch expressions (lines starting with
  `>`)... Ctrl+C cancels.

    15 | > lit1
           ⧩
           """
           This is a raw text literal.
           It can start with 3 or more ",
           and is terminated by the same number of quotes.
           Nothing is escaped. \n
           
           The initial newline, if it exists, is ignored.
           The last line, if it's just whitespace up to the closing quotes,
           is ignored.
           
           Use an extra blank line if you'd like a trailing newline. Like so:
           
           """
  
    16 | > Some lit1
           ⧩
           Some
             "This is a raw text literal.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThe initial newline, if it exists, is ignored.\nThe last line, if it's just whitespace up to the closing quotes,\nis ignored.\n\nUse an extra blank line if you'd like a trailing newline. Like so:\n"
  
    27 | > lit2
           ⧩
           """"
           This is a raw text literal, indented.
           It can start with 3 or more ",
           and is terminated by the same number of quotes.
           Nothing is escaped. \n
           
           This doesn't terminate the literal - """
           """"
  
    28 | > Some lit2
           ⧩
           Some
             "This is a raw text literal, indented.\nIt can start with 3 or more \",\nand is terminated by the same number of quotes.\nNothing is escaped. \\n\n\nThis doesn't terminate the literal - \"\"\""

scratch/main> add

  ⍟ I've added these definitions:
  
    lit1 : Text
    lit2 : Text

scratch/main> view lit1 lit2

  lit1 : Text
  lit1 =
    """
    This is a raw text literal.
    It can start with 3 or more ",
    and is terminated by the same number of quotes.
    Nothing is escaped. \n
    
    The initial newline, if it exists, is ignored.
    The last line, if it's just whitespace up to the closing quotes,
    is ignored.
    
    Use an extra blank line if you'd like a trailing newline. Like so:
    
    """
  
  lit2 : Text
  lit2 =
    """"
    This is a raw text literal, indented.
    It can start with 3 or more ",
    and is terminated by the same number of quotes.
    Nothing is escaped. \n
    
    This doesn't terminate the literal - """
    """"