### Bug description

When rendering to markdown, if any cell output contains fenced codeblocks, the closing fence characters get escaped (or weirder things happen, if several fenced code blocks appear in a cell output).

I'm seeing this on a mac osx, on quart version `1.1.251`. Note that the examples render to github flavored markdown, but `format: markdown` behaves in similar ways.



## Basic Example

**qmd**

``````md
---
format: gfm
jupyter:
  jupytext:
    text_representation:
      extension: .qmd
      format_name: quarto
      format_version: '1.0'
      jupytext_version: 1.14.1
  kernelspec:
    display_name: Python 3 (ipykernel)
    language: python
    name: python3
---

# example

```{python}
def make_codeblock():
    return "```python\n1 + 1\n```"

print(make_codeblock())
```


``````

**output**

Note the `` \`\`\` ``

``````md
# example

``` python
def make_codeblock():
    return "```python\n1 + 1\n```"

print(make_codeblock())
```

    ```python
    1 + 1

\`\`\`
``````

## Example: multiple code blocks in output

Note that if you run multiple prints, stranger things happen:

**code:**

``````
print(make_codeblock())

print(make_codeblock())
``````

**cell output:**

``````
    ```python
    1 + 1

``` python
1 + 1
```

\`\`\`

``````

## Looks okay in jupyter notebook

<img width="884" alt="image" src="https://user-images.githubusercontent.com/2574498/200058153-9d445d3c-4825-446f-826e-e6a65ebc8a37.png">


### Checklist

- [X] Please include a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
- [X] Please [format your issue](https://quarto.org/bug-reports.html#formatting-make-githubs-markdown-work-for-us) so it is easier for us to read the bug report.
- [X] Please document the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
- [X] Please document the operating system you're running. If on Linux, please provide the specific distribution.
cscheid
2022-11-04T19:22:55Z
machow
bug jupyter
v1.3
closed
Conversion to markdown incorrectly escapes backticks in printed output
https://github.com/quarto-dev/quarto-cli/issues/3179