diff --git a/cmd/tools/vdoc/html.v b/cmd/tools/vdoc/html.v
index 7f5356dc4f..588089395a 100644
--- a/cmd/tools/vdoc/html.v
+++ b/cmd/tools/vdoc/html.v
@@ -326,8 +326,8 @@ fn html_highlight(code string, tb &ast.Table) string {
tok_typ = .builtin
} else if next_tok.kind == .lcbr {
tok_typ = .symbol
- } else if next_tok.kind == .lpar
- || (!tok.lit[0].is_capital() && next_tok.kind == .lt) {
+ } else if next_tok.kind == .lpar || (!tok.lit[0].is_capital()
+ && next_tok.kind == .lt && next_tok.pos == tok.pos + tok.lit.len) {
tok_typ = .function
} else {
tok_typ = .name
diff --git a/cmd/tools/vdoc/utils.v b/cmd/tools/vdoc/utils.v
index 9bde83b5d9..18d6904639 100644
--- a/cmd/tools/vdoc/utils.v
+++ b/cmd/tools/vdoc/utils.v
@@ -211,7 +211,8 @@ fn color_highlight(code string, tb &ast.Table) string {
&& prev.kind in [.name, .amp, .rsbr, .key_type, .assign, .dot, .question, .rpar, .key_struct, .key_enum, .pipe, .key_interface]
&& (tok.lit[0].is_capital() || prev_prev.lit in ['C', 'JS']) {
tok_typ = .symbol
- } else if next_tok.kind in [.lpar, .lt] {
+ } else if next_tok.kind == .lpar || (!tok.lit[0].is_capital()
+ && next_tok.kind == .lt && next_tok.pos == tok.pos + tok.lit.len) {
tok_typ = .function
} else if next_tok.kind == .dot {
if tok.lit in ['C', 'JS'] {