Skip to content

Commit

Permalink
docs: fix function with namespace arg
Browse files Browse the repository at this point in the history
  • Loading branch information
aguingand committed Dec 16, 2024
1 parent 864235f commit 93d36fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
9 changes: 7 additions & 2 deletions docs/.vitepress/theme/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,18 @@
}
:is(h3, h4) code {
font-size: .875em;
.token[data-content] {
.token {
opacity: .5;
&::before {
content: attr(data-content);
}
.token {
&::before {
content: "\200B" attr(data-content) "\200B";
}
}
}
.token.punctuation {
.token.punctuation, .token.function {
opacity: 1;
}
}
Expand Down
8 changes: 4 additions & 4 deletions docs/.vitepress/transform-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ export function transformContent(html: string) {

// apply syntax highlight to h3 with sole code element
[...content.querySelectorAll(':is(h3, h4) > code')]
.filter(code =>
![...code.parentElement.childNodes].some(node => node.nodeName === '#text' && node.textContent.trim())
)
// .filter(code =>
// ![...code.parentElement.childNodes].some(node => node.nodeName === '#text' && node.textContent.trim())
// )
.forEach(code => {
code.classList.add('inline', 'full');
code.innerHTML = Prism.highlight(code.innerHTML, Prism.languages.php, 'php');
code.querySelectorAll('.token').forEach(token => {
if(!token.matches('.function')) {
if(!token.matches('.function') && !token.childElementCount) {
token.setAttribute('data-content', token.innerHTML);
token.innerHTML = '';
}
Expand Down

0 comments on commit 93d36fe

Please sign in to comment.