chore(*): fix highlite
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
72c84425d6
commit
221cbfeafe
@ -35,10 +35,14 @@ const { title, authors, description } = Astro.props;
|
||||
let deck = new Reveal({
|
||||
plugins: [Highlight, Zoom, Notes],
|
||||
});
|
||||
deck.initialize();
|
||||
|
||||
document.addEventListener('DOMContentLoaded', async function() {
|
||||
const codeBlocks = document.querySelectorAll('code[data-external]');
|
||||
deck.initialize().then(() => {
|
||||
// Загружаем внешний код после инициализации Reveal
|
||||
loadExternalCode();
|
||||
});
|
||||
|
||||
async function loadExternalCode() {
|
||||
const codeBlocks = document.querySelectorAll("code[data-external]");
|
||||
|
||||
for (const block of codeBlocks) {
|
||||
try {
|
||||
@ -46,17 +50,12 @@ document.addEventListener('DOMContentLoaded', async function() {
|
||||
const code = await response.text();
|
||||
block.textContent = code;
|
||||
|
||||
// Обновляем подсветку после загрузки кода
|
||||
if (Reveal.getPlugin('highlight')) {
|
||||
Reveal.getPlugin('highlight').hljs.highlightBlock(block);
|
||||
}
|
||||
|
||||
// Правильный способ обновить подсветку
|
||||
deck.getPlugin("highlight").hljs.highlightBlock(block);
|
||||
} catch (error) {
|
||||
block.textContent = '⚠️ Error loading code: ' + error.message;
|
||||
block.textContent = "⚠️ Error: " + error.message;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</Layout>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user