Skip to content

Commit

Permalink
fix: fix logic for generating directive tags (#8171)
Browse files Browse the repository at this point in the history
  • Loading branch information
HyperLife1119 authored Nov 30, 2023
1 parent 5fd0b31 commit e37eab2
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scripts/site/utils/marked.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ function createLabel(label) {
return `<label class="api-type-label ${label}">${label}</label>`;
}

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

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

0 comments on commit e37eab2

Please sign in to comment.