. tests/functions.sh title "code blocks" rc=0 MARKDOWN_FLAGS= try 'format for code block html' \ ' this is code' \ '
this is
code
' try 'mismatched backticks' '```tick``' '

`tick

' try 'mismatched backticks(2)' '``tick```' '

``tick```

' try 'unclosed single backtick' '`hi there' '

`hi there

' try 'unclosed double backtick' '``hi there' '

``hi there

' try 'triple backticks' '```hi there```' '

hi there

' try 'quadruple backticks' '````hi there````' '

hi there

' try 'remove space around code' '`` hi there ``' '

hi there

' try 'code containing backticks' '`` a```b ``' '

a```b

' try 'backslash before backtick' '`a\`' '

a\

' try '`>`' '`>`' '

>

' try '`` ` ``' '`` ` ``' '

`

' try '````` ``` `' '````` ``` `' '

`` `

' try '````` ` ```' '````` ` ```' '

`` `

' try 'backslashes in code(1)' ' printf "%s: \n", $1;' \ '
printf "%s: \n", $1;
' try 'backslashes in code(2)' '`printf "%s: \n", $1;`' \ '

printf "%s: \n", $1;

' if ./markdown -V | grep FENCED-CODE >/dev/null; then try 'fenced code block' \ '~~~ code! ~~~' \ '
code!
' try 'fenced code block in list' \ '1. ~~~ code block ~~~' \ '
  1. code block
    
' try 'fenced code block in blockquote' \ '>~~~ code ~~~' \ '
code
' try 'unterminated fenced code block' \ '~~~ code' \ '

~~~ code

' try 'fenced code block with tildes' \ '~~~~~ ~~~ code with tildes ~~~ ~~~~~' \ '
~~~
code with tildes
~~~
' try 'paragraph with trailing fenced block' \ 'text text text text text text ~~~ code code code? ~~~' \ '

text text text text text text ~~~ code code code? ~~~

' try 'fenced code blocks with backtick delimiters' \ '``` code ```' \ '
code
' try 'fenced code block with mismatched delimters' \ '``` code ~~~' \ '

``` code ~~~

' fi summary $0 exit $rc