Skip to content

Commit

Permalink
fix: added more whiteList tags in build-pages (#2986)
Browse files Browse the repository at this point in the history
  • Loading branch information
akshatnema authored May 22, 2024
1 parent de99b10 commit 6a3c681
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions scripts/build-pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const path = require('path');
const SRC_DIR = 'markdown';
const TARGET_DIR = 'pages';

const whiteListTags = ['a', 'br', 'div', 'b', 'i'];
const capitalizeTags = ['table', 'tr', 'td', 'th', 'thead', 'tbody'];

// Check if target directory doesn't exist then create it
if (!fs.existsSync(TARGET_DIR)) {
Expand All @@ -13,10 +13,10 @@ if (!fs.existsSync(TARGET_DIR)) {

function capitalizeJsxTags(content) {
return content.replace(/<\/?(\w+)/g, function (match, letter) {
if (whiteListTags.includes(letter.toLowerCase())) {
return match; // return the match as is, without capitalizing
if (capitalizeTags.includes(letter.toLowerCase())) {
return `<${match[1] === '/' ? '/' : ''}${letter[0].toUpperCase()}${letter.slice(1)}`;
}
return `<${match[1] === '/' ? '/' : ''}${letter[0].toUpperCase()}${letter.slice(1)}`;
return match;
});
}

Expand Down

0 comments on commit 6a3c681

Please sign in to comment.