-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
aabc9ba
commit 288fab9
Showing
1 changed file
with
25 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
document.addEventListener('DOMContentLoaded', (event) => { | ||
const codeBlock = document.createElement('pre'); | ||
const codeContent = document.createElement('code'); | ||
codeContent.className = 'language-html'; | ||
codeContent.textContent = document.documentElement.outerHTML; | ||
codeBlock.appendChild(codeContent); | ||
codeBlock.className = | ||
'code-block bg-gray-900 text-gray-100 p-4 rounded mt-4 overflow-x-auto text-sm'; | ||
|
||
const explanationParagraph = document.createElement('p'); | ||
explanationParagraph.className = 'mt-4 text-base text-gray-600'; | ||
explanationParagraph.textContent = | ||
'The code block below shows the current HTML document source after the edge function has processed it:'; | ||
|
||
const lastParagraph = document.querySelector('body p:last-of-type'); | ||
if (lastParagraph) { | ||
lastParagraph.insertAdjacentElement('afterend', explanationParagraph); | ||
explanationParagraph.insertAdjacentElement('afterend', codeBlock); | ||
} else { | ||
document.body.appendChild(explanationParagraph); | ||
document.body.appendChild(codeBlock); | ||
} | ||
|
||
Prism.highlightElement(codeContent); | ||
}); |