Google-docs – How to get inserted HTML to render in Google Docs

google docshtml

I found this question, which seems to suggest I can just paste in my HTML, but when I try that it just looks like HTML, it does not render. Below is what I am pasting in:

<pre style="background:rgba(238,238,238,0.92);color:#000">&lt;?php
$stmt <span style="color:#00f">=</span> $dbConnection<span style="color:#00f">-></span>prepare(<span style="color:#093">'<span style="color:#00f">SELECT</span> <span style="color:#00f">*</span> <span style="color:#00f">FROM</span> employees <span style="color:#00f">WHERE</span> name <span style="color:#00f">=</span> ?'</span>);
$stmt<span style="color:#00f">-></span>bind_param(<span style="color:#093">'s'</span>, $name);

$stmt<span style="color:#00f">-></span>execute();

$result <span style="color:#00f">=</span> $stmt<span style="color:#00f">-></span>get_result();
<span style="color:#00f">while</span> ($row <span style="color:#00f">=</span> $result<span style="color:#00f">-></span>fetch_assoc()) {
    <span style="color:#06f;font-style:italic">// do something with $row</span>
}
?>
</pre>

Does anyone know what I need to do to get it to actually render?

Best Answer

Google docs won't actually render HTML, or execute any code pasted into it. What you can do is view your HTML as a page in the browser, which will show:

php code

Copy it from the web page, then paste into your document - it will look like this:

PHP pasted to Google docs

The question you referred to was for people who wanted to present their HTML code within the document with syntax highlighting, not have it rendered.