### Bug description

[`code-filename`](https://quarto.org/docs/output-formats/html-code.html#code-filename) is not working for latest pre-release [version 1.3.151](https://quarto.org/docs/download/prerelease.html) for pdf output format but works for html format. But `code-filename` was working for both formats in previous versions.

### `format: html` (Works!)

~~~
---
title: "Untitled"
format: html
---

## filename

```{.python filename="matplotlib.py"}
import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()
```
~~~

![image](https://user-images.githubusercontent.com/48413872/216588659-9060a776-cf79-49e3-96cf-ec41c9d50dd9.png)


### `format: pdf` (Doesn't Work!)

~~~
---
title: "Untitled"
format: pdf
---

## filename

```{.python filename="matplotlib.py"}
import matplotlib.pyplot as plt
plt.plot([1,23,2,4])
plt.show()
```
~~~

And getting this error (from quarto's internal lua filter)

> Error running filter C:/Users/User/AppData/Local/Programs/Quarto/share/filters/main.lua:
PandocLuaError "...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:3369: bad argument `#1` to 'insert' (table expected, got nil)\nstack traceback:\n\t...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:3369: in function 'tprepend'\n\t...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:14710: in function <...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:14659>\n\t(...tail calls...)\n\t...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:67: in function 'process_custom'\n\t(...tail calls...)\n\t[C]: in ?\n\t[C]: in method 'walk'\n\t...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:153: in function 'run_emulated_filter'\n\t...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:405: in local 'callback'\n\t...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:410: in upvalue 'run_emulated_filter_chain'\n\t...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:451: in function <...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:432>"
stack traceback:
	...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:153: in function 'run_emulated_filter'
	...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:405: in local 'callback'
	...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:410: in upvalue 'run_emulated_filter_chain'
	...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:451: in function <...ser/AppData/Local/Programs/Quarto/share/filters/main.lua:432>


I am running Quarto from **RStudio 2022.07.2+576 "Spotted Wakerobin"** and using **windows 10**.

~~~
> xfun::session_info()
R version 4.2.1 (2022-06-23 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 10 x64 (build 19044), RStudio 2022.7.2.576
~~~

~~~
RStudio 2022.07.2+576 "Spotted Wakerobin" Release (e7373ef832b49b2a9b88162cfe7eac5f22c40b34, 2022-09-06) for Windows
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.8
Chrome/69.0.3497.128 Safari/537.36
~~~


### 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
2023-02-03T11:18:11Z
shafayetShafee
bug
v1.3
closed
code filename is not working for pre-release Quarto version 1.3.151 for pdf format
https://github.com/quarto-dev/quarto-cli/issues/4200