I don't really understand what do you mean by this.
If I use the following, where I've used no lists, I obtain reprex.pdf (119.5 KB). As you can see, the code chunk is identified correctly.
---
title: "Example"
output: pdf_document
---
# first heading
some text
# second heading
will include some code now
```{r }
y <- rnorm(n = 100)
plot(x = y)
```
text after code
# third heading
again some text
Will you please share a small Rmarkdown
code to illustrate your problem in form of a reprex?