diff --git a/cmd/tools/vdoc/html.v b/cmd/tools/vdoc/html.v index 59dbd14a02dd95..8998992542362f 100644 --- a/cmd/tools/vdoc/html.v +++ b/cmd/tools/vdoc/html.v @@ -617,7 +617,7 @@ fn (f &MdHtmlCodeHighlighter) transform_attribute(p markdown.ParentType, name st fn (f &MdHtmlCodeHighlighter) transform_content(parent markdown.ParentType, text string) string { if parent is markdown.MD_BLOCKTYPE && parent == .md_block_code { if f.language == '' { - return text + return html.escape(text) } output := html_highlight(text, f.table) // Reset the language, so that it will not persist between blocks, diff --git a/cmd/tools/vdoc/testdata/output_formats/README.md b/cmd/tools/vdoc/testdata/output_formats/README.md index 87514fdd6e3cc7..3c8bbdc3bcc5d8 100644 --- a/cmd/tools/vdoc/testdata/output_formats/README.md +++ b/cmd/tools/vdoc/testdata/output_formats/README.md @@ -150,4 +150,14 @@ A code block without a specific language should be rendered verbatim: └── main.v ``` +The s tags here in the code block, should be rendered verbatim, not interpreted as HTML ones: +``` +h:m:s // 5:02:33 +m:s.mi // 2:33.015 +s.mi // 33.015s +mi.mc // 15.007ms +mc.ns // 7.234us +ns // 234ns +``` + The End. diff --git a/cmd/tools/vdoc/testdata/output_formats/main.ansi b/cmd/tools/vdoc/testdata/output_formats/main.ansi index 73895c9014136e..965869d46e00a0 100644 --- a/cmd/tools/vdoc/testdata/output_formats/main.ansi +++ b/cmd/tools/vdoc/testdata/output_formats/main.ansi @@ -128,6 +128,14 @@ A code block without a specific language should be rendered verbatim: │ └── main.js └── main.v +The s tags here in the code block, should be rendered verbatim, not interpreted as HTML ones: +h:m:s // 5:02:33 +m:s.mi // 2:33.015 +s.mi // 33.015s +mi.mc // 15.007ms +mc.ns // 7.234us +ns // 234ns + The End. module main ## Description @@ -281,6 +289,16 @@ The End. └── main.v ``` + The s tags here in the code block, should be rendered verbatim, not interpreted as HTML ones: + ``` + h:m:s // 5:02:33 + m:s.mi // 2:33.015 + s.mi // 33.015s + mi.mc // 15.007ms + mc.ns // 7.234us + ns // 234ns + ``` + The End. const omega = 3 // should be first diff --git a/cmd/tools/vdoc/testdata/output_formats/main.html b/cmd/tools/vdoc/testdata/output_formats/main.html index fb3cc00d5137c1..fe74760622d42d 100644 --- a/cmd/tools/vdoc/testdata/output_formats/main.html +++ b/cmd/tools/vdoc/testdata/output_formats/main.html @@ -97,6 +97,12 @@

Description

This is an example of a an .md file, used for adding more │ └── js/ │ └── main.js └── main.v +

The s tags here in the code block, should be rendered verbatim, not interpreted as HTML ones:

h:m:s      // 5:02:33
+m:s.mi<s>  // 2:33.015
+s.mi<s>    // 33.015s
+mi.mc<ms>  // 15.007ms
+mc.ns<ns>  // 7.234us
+ns<ns>     // 234ns
 

The End.

diff --git a/cmd/tools/vdoc/testdata/output_formats/main.text b/cmd/tools/vdoc/testdata/output_formats/main.text index 28741ac5321b85..21579c4da772c8 100644 --- a/cmd/tools/vdoc/testdata/output_formats/main.text +++ b/cmd/tools/vdoc/testdata/output_formats/main.text @@ -150,6 +150,16 @@ module main └── main.v ``` + The s tags here in the code block, should be rendered verbatim, not interpreted as HTML ones: + ``` + h:m:s // 5:02:33 + m:s.mi // 2:33.015 + s.mi // 33.015s + mi.mc // 15.007ms + mc.ns // 7.234us + ns // 234ns + ``` + The End. const omega = 3 // should be first