-
How can the the full contents of a text file containing HTML be printed, but without any rendering? This would mirror the printing functionality of Window's Notepad, but enable use of Visual Studio Code's enhanced functionality As an example, how can all the text below - including HTML tags - be printed, just as it appears, without rendering? <!doctype html>
<html>
<head>
<title>Page title</title>
</head>
<body>
<p>Example paragraph.</p>
</body>
</html> The |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
No special steps are required. This is what happened on my system with default settings and your own sample saved into a file The renderer that is used will depend on the language identifier determined by VS Code. This is largely determined by the file type extension, so I also tried pasting your HTML into an unsaved document, with this result.
I wonder whether VS Code thinks your file contains Markdown. If you embed HTML in Markdown it is rendered, with the exception of processing directives which are not recognised as directives unless they appear before If you're trying to print a snippet of HTML in the middle of a Markdown document because you're writing documentation or an assignment for university, use a fence, just as you did when composing this issue.
NoteIf this isn't the behaviour you're seeing, report an issue with details of how you produce the failure and any other information you think might be pertinent. |
Beta Was this translation helpful? Give feedback.
-
Thanks @PeterWone, your explanation helped me identify why I found this as an issue but you did not. The issue arises from the language identifier selected by VS Code from the file extension:
Text files are rendered, html files are not rendered. The solution is to identify to VS Code the files as text. |
Beta Was this translation helpful? Give feedback.
-
Thank you for following up on this. You may have identified a bug in the handling of text files. It is necessary to inhibit HTML rendering for plain text, either by wrapping it in a |
Beta Was this translation helpful? Give feedback.
-
I checked and the content of plain text files is wrapped in a |
Beta Was this translation helpful? Give feedback.
No special steps are required.
This is what happened on my system with default settings and your own sample saved into a file
sample.html
The renderer that is used will depend on the language identifier determined by VS Code. This is largely determined by the file type extension, so I also tried pasting your HTML into an unsaved document, with this result.