From f38ca9b825eec9e24ac623bd6058f7773c4bec7f Mon Sep 17 00:00:00 2001 From: Delyan Angelov Date: Fri, 1 Aug 2025 20:48:26 +0300 Subject: [PATCH] tools: fix vdoc tests after the vlang/markdown -> html `

Title Topic

` change --- .../vdoc/testdata/output_formats/main.html | 56 +++++++++++++++---- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/cmd/tools/vdoc/testdata/output_formats/main.html b/cmd/tools/vdoc/testdata/output_formats/main.html index 1cc37c15c1..628a7d0856 100644 --- a/cmd/tools/vdoc/testdata/output_formats/main.html +++ b/cmd/tools/vdoc/testdata/output_formats/main.html @@ -1,15 +1,29 @@

main #

-

Description

This is an example of a an .md file, used for adding more rich text documentation in a project or module.

This is a link to the main V site.

This is a bold text.

This is a script <script>console.log('hi from README.md');</script> .

Examples

Functions that return different literals:

Example of a function returning boolean:

fn is_odd(x int) bool {
+

Description

+

This is an example of a an .md file, used for adding more rich text documentation in a project or module.

+

This is a link to the main V site.

+

This is a bold text.

+

This is a script <script>console.log('hi from README.md');</script> .

+

Examples

+

Functions that return different literals:

+

Example of a function returning boolean:

+
fn is_odd(x int) bool {
     if x % 2 == 0 {
         return false
     }
     return true
-}

Another example of a function returning a string:

fn answer() string {
+}
+

Another example of a function returning a string:

+
fn answer() string {
     return '42'
-}

This example shows a function returning a string with interpolation:

fn str_with_interplation() string {
+}
+

This example shows a function returning a string with interpolation:

+
fn str_with_interplation() string {
     return 'this string has ${42:6} interpolation in it.'
-}

Processing command line args

import os
+}
+

Processing command line args

+
import os
 
 fn main() {
     dump(os.args)
@@ -23,7 +37,9 @@
 
     ch := chan bool{cap: 1}
     ch <- true
-}

A JWT example (test syntax highlighting)

import crypto.hmac
+}
+

A JWT example (test syntax highlighting)

+
import crypto.hmac
 import crypto.sha256
 import encoding.base64
 import json
@@ -66,7 +82,9 @@
         sha256.sum, sha256.block_size)
     signature_from_token := base64.url_decode(token_split[2])
     return hmac.equal(signature_from_token, signature_mirror)
-}

Other language specifiers

##
+}
+

Other language specifiers

+
##
 std::map<std::string, int> my_map {
     {'KEY_1', 0},
     {'KEY_2', 10},
@@ -75,8 +93,11 @@ std::for (const auto &[key, value] : my_map) {
     std::cout << key << ': ' << value << ', ';
 }
-std::cout << '\n';
doc1 := toml.parse_text(<string content>) or { panic(err) }
-doc2 := toml.parse_file(<file path>) or { panic(err) }

Escape html in strings

const html = '<!DOCTYPE html>
+std::cout << '\n';
+
doc1 := toml.parse_text(<string content>) or { panic(err) }
+doc2 := toml.parse_file(<file path>) or { panic(err) }
+

Escape html in strings

+
const html = '<!DOCTYPE html>
 <html lang="en">
   <head>
     <style>
@@ -99,20 +120,33 @@ doc2 := toml
       console.log(res);
     }
   </script>
-</html>'
  • Regular markdown list point 1
  • List point 2
  • List point 3
  1. Numbered markdown list point 1
  2. List point 2
  3. List point 3

A code block without a specific language should be rendered verbatim:

.
+</html>'
+
    +
  • Regular markdown list point 1
  • +
  • List point 2
  • +
  • List point 3
+
    +
  1. Numbered markdown list point 1
  2. +
  3. List point 2
  4. +
  5. List point 3
+

A code block without a specific language should be rendered verbatim:

+
.
 ├── static/
 │   ├── css/
 │   │   └── main.css
 │   └── 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
+
+

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.

+
+

The End.