-
-
Notifications
You must be signed in to change notification settings - Fork 828
Migrate highlight.js API Call Usage in TextualBody.tsx #9989
Migrate highlight.js API Call Usage in TextualBody.tsx #9989
Conversation
Updated highlight usage to use highlight(code, options) instead as highlight(lang, code, ...args) has been deprecated
Updated highlight usage to use highlight(code, options) instead as highlight(lang, code, ...args) has been deprecated Signed-off-by: Mustafa Kapadia <mustafakapadia76@gmail.com>
Also, I don't think you need a 'Notes' tag in this PR: it's not a user-facing change so it doesn't need to be in the changelog (the explanation is useful though, so I'd keep it in the description, just not as a changelog note). |
early exit in case code text content is empty & removed initialization of advertisedLang as empty string
Thank You @dbkr for reviewing the changes, I have made the changes as per the review |
if (code.textContent.length > MAX_HIGHLIGHT_LENGTH) { | ||
const codeTextContent = code.textContent; | ||
if (!codeTextContent) { | ||
console.log("Code block is empty"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We use the loglevel library for logging, so no console.log statements, although I don't think a log line is necessary here - it could get quite noisy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dbkr there was a console.log when codeTextContent.length > MAX_HIGHLIGHT_LENGTH hence I thought same process should be replicated when exiting early for empty string / null
ref:
if (codeTextContent.length > MAX_HIGHLIGHT_LENGTH) {
console.log(
"Code block is bigger than highlight limit (" +
codeTextContent.length +
" > " +
MAX_HIGHLIGHT_LENGTH +
"): not highlighting",
);
return;
}
Should both console.logs be removed then ?
Duplicate of #9923 |
Checklist
Type: Task
Updated highlight usage to use highlight(code, options) instead as highlight(lang, code, ...args) has been deprecated
fixes Update highlight.js usage in-code #22233
Signed-off-by: Mustafa Kapadia mustafakapadia76@gmail.com
This change is marked as an internal change (Task), so will not be included in the changelog.