Website: update automatic formatting of osquery schema table examples (#19881)

Closes: #19750

Changes:
- Updated osquery table schema pages to preserve whitespace and newlines
in multi-line examples.
This commit is contained in:
Eric 2024-06-19 16:35:39 -05:00 committed by GitHub
parent 00a2e6bac2
commit 688d86afd3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 6 deletions

View file

@ -90,11 +90,14 @@ parasails.registerPage('osquery-table-details', {
$(block).html(replacementHMTL);
// After we've highlighted our keywords, we'll highlight the rest of the codeblock
window.hljs.highlightElement(block);
});
// Adding [purpose="line-break"] to SQL keywords if they are one of: SELECT, WHERE, FROM, JOIN. (case-insensitive)
$('.hljs-keyword').each((i, el)=>{
for(i in el.innerText.match(/select|where|from|join/gi)) {
$(el).attr({'purpose':'line-break'});
// If this example is a single-line, we'll do some basic formatting to make it more human-readable.
if(!$(block)[0].innerText.match(/\n/gmi)){
// Adding [purpose="line-break"] to SQL keywords if they are one of: SELECT, WHERE, FROM, JOIN. (case-insensitive)
$('.hljs-keyword').each((i, el)=>{
for(i in el.innerText.match(/select|where|from|join/gi)) {
$(el).attr({'purpose':'line-break'});
}
});
}
});
})();

View file

@ -294,7 +294,6 @@
background-color: @ui-off-white;
border: none;
word-break: break-word;
white-space-collapse: collapse;
text-wrap: wrap;
padding: 0;
font-size: 13px;