Shiny htmloutput : s<!DOCTYPE html> on the top of page

The problem is: My project is shiny app based on inputs that generate a report that is dependent on Rmarkdown template document with parameters. I need to preview the report in the shiny app after entering these inputs that will affect these parameters.

The problem: that I found
on the top of page. See the attached photo.

The app code:
in UI part:
uiOutput('markdown')

in server part:
output$markdown <- renderUI({
HTML(markdownToHTML(render('HTMLesoApp.Rmd',output_format = html_document(),
params = list(A= input$search,
A0= input$author,
A1 = input$EsophagealCarcinomaProcedure,
A3 = input$EsophagealCarcinomaTumorSite))))})

if I used Knit function instead of render the problem disappear, but I can not pass the parameters inputs.

I am no shiny expert but a few thing I spotted and puzzle me.

You trying to convert markdown to HTML here...

... but your render to a full HTML file using header and body.

This seems odd to me.

Know that in rmarkdown you have rmarkdown::html_fragment to generate a piece of HTML from Rmd (just the body).

Including a whole HTML page (including DOCTYPE - which what you see, <head> and <body>) may not be ideal and why you don't get the desired results

I tried your suggestion and still appear!
it could disappear if I chose knit function instead of render function.
but I can not pass the params ( user inputs ) to knit function.

Any other suggestions?
It appears that you are working for Rstudio, can you please ask one of our friends in Rstudio?

Can you share the code you tried now ? What change did you make ? Did you render as a fragment ? What does the HTML document generated by your render looks like ?