gt() tables in markdown visual editor

I am using Rmarkdown with the gt package for tables. Tables come out fine using knitr (latex pdf), but they do not show up in the visual editor. ggplot graphs show up fine in the editor.
Has anybody had a similar problem. Thank you.

Hi and welcome to the RStudio Community!

As a quick test I did this without any issue. Do you get something different, or am I misunderstanding your question?

And in the visual markdown editor:

Thank you for your reply.
I have copied in a picture of the first part of my docment. I have used the same commands and data as you did.
My output type is pdf, and I have a special layout based on asa-article. I have some extra commands at the opts_chunk. The table does not show up in the visual editor.

I tried again, using a new html document exactly as you did. Then it worked fine.
The settings are the same as I used in the other document.