Skip to content

Commit e37eab2

Browse files
fix: fix logic for generating directive tags (#8171)
1 parent 5fd0b31 commit e37eab2

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

scripts/site/utils/marked.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ function createLabel(label) {
117117
return `<label class="api-type-label ${label}">${label}</label>`;
118118
}
119119

120+
const DIRECTIVE_REGEX = /^\[[a-zA-Z-]+\]/;
120121
const STANDALONE_SUFFIX_REGEX = /:standalone$/;
121122

122123
/**
@@ -141,7 +142,7 @@ function normalizeHead(text) {
141142
renderer.heading = function (text, level) {
142143
const lowerText = text.toLowerCase().replace(/ /g, '-').replace(/\./g, '-').replace(/\?/g, '');
143144
const isMarkedLabel = level === 3 && text.indexOf('nz-') === 0;
144-
const isDirective = text[0] === '[' && text[text.length - 1] === ']';
145+
const isDirective = DIRECTIVE_REGEX.test(text);
145146
const isComponent = isMarkedLabel && !isDirective;
146147
const isStandalone = STANDALONE_SUFFIX_REGEX.test(text);
147148
const isService = text.indexOf('Nz') === 0 && text.indexOf('Service') > -1;

0 commit comments

Comments
 (0)