mirror of
https://github.com/clearlinux/clear-linux-documentation.git
synced 2026-10-03 23:48:28 +00:00
* Adds ability to create code blocks with prepended "$" that won't be copied (wip). (#837)
* Fixes behavior and appearance of permalinks in collapsible sections. * Fixes links to collapsible sections so that header is now target. Signed-off-by: Kevin Putnam <kevin.putnam@intel.com>
This commit is contained in:
committed by
michael vincerra
parent
fbfe5f43c6
commit
0df6c38203
@@ -119,6 +119,8 @@ th,td {
|
||||
padding-left: 0 !important;
|
||||
}
|
||||
|
||||
/*Begin support for collapsbile sections*/
|
||||
|
||||
.clps1 {
|
||||
font-size: 175%;
|
||||
}
|
||||
@@ -176,6 +178,26 @@ th,td {
|
||||
transition: max-height 0.2s ease-out;
|
||||
}
|
||||
|
||||
/*Fix for permalinks to collapsible sections*/
|
||||
|
||||
button a.headerlink {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
button a.headerlink:after {
|
||||
content: "\f0c1";
|
||||
font-size: 14px;
|
||||
font-family: FontAwesome;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
button:hover a.headerlink:after {
|
||||
visibility: visible;
|
||||
}
|
||||
|
||||
/*End support for collapsbile sections*/
|
||||
|
||||
/*Begin support for custom Clear Linux header*/
|
||||
#header {
|
||||
width: 100%;
|
||||
display: block;
|
||||
@@ -278,6 +300,8 @@ th,td {
|
||||
line-height: 100px;
|
||||
}
|
||||
|
||||
/*End support for custom Clear Linux header*/
|
||||
|
||||
/*Adds a bit of spacing after the last paragraph in a bulleted list*/
|
||||
.wy-plain-list-disc li p:last-child, .rst-content .section ul li p:last-child, .rst-content .toctree-wrapper ul li p:last-child, article ul li p:last-child {
|
||||
margin-bottom: 10px;
|
||||
@@ -291,7 +315,7 @@ div#trademarks {
|
||||
color: gray;
|
||||
}
|
||||
|
||||
|
||||
/*Adds magnifying glass to search box*/
|
||||
#clear-docs-search {
|
||||
background: url(./mag-glass.png) left no-repeat;
|
||||
background-size: 15px 15px;
|
||||
@@ -312,3 +336,11 @@ div#trademarks {
|
||||
.pending-delete-status {
|
||||
color:#ce2029;
|
||||
}
|
||||
|
||||
/*Begin support for code blocks with $ signs that aren't copied with content*/
|
||||
|
||||
.bash-dollar:before {
|
||||
content: '$ ';
|
||||
}
|
||||
|
||||
/*End support for code blocks with $ signs that aren't copied with content*/
|
||||
@@ -1,21 +1,34 @@
|
||||
var i;
|
||||
var contents = document.getElementsByClassName("content-collapse section");
|
||||
|
||||
var bashDollarDivs = document.getElementsByClassName("bash-dollars highlight-bash");
|
||||
|
||||
for (i = 0; i< bashDollarDivs.length; i++) {
|
||||
_pre = bashDollarDivs[i].querySelectorAll("pre");
|
||||
for (j = 0; j < _pre.length; j++) {
|
||||
console.log(_pre[j]);
|
||||
_pre[j].innerHTML="<span class='bash-dollar'>"+(_pre[j].textContent.split("\n").filter(Boolean).join("</span>\n<span class='bash-dollar'>"))+"</span>";
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; i < contents.length; i++) {
|
||||
|
||||
//Make sure the "content-collapse section" class is occurring in <div>
|
||||
if (contents[i].tagName.toLowerCase() == 'div') {
|
||||
var element = contents[i].children[0];
|
||||
var element_type = element.tagName.toLowerCase();
|
||||
var span_id;
|
||||
var spanElement;
|
||||
var btn_id;
|
||||
var divElement;
|
||||
|
||||
//if the next element is a span grab the id and skip to the header
|
||||
divElement = contents[i];
|
||||
btn_id = contents[i].id;
|
||||
|
||||
//if the next element is a span skip to the header
|
||||
if (element_type == 'span') {
|
||||
span_id = element.id;
|
||||
element.id = "";
|
||||
element = contents[i].children[1];
|
||||
element_type = element.tagName.toLowerCase();
|
||||
} else {
|
||||
divElement.id = "";
|
||||
}
|
||||
|
||||
var btn = document.createElement("BUTTON");
|
||||
@@ -28,7 +41,7 @@ for (i = 0; i < contents.length; i++) {
|
||||
btn.className += " " + newClass;
|
||||
btn.innerHTML = element.innerHTML;
|
||||
btn.className += " collapsible";
|
||||
btn.id = span_id;
|
||||
btn.id = btn_id;
|
||||
btn.addEventListener("click", function() {
|
||||
this.classList.toggle("active");
|
||||
var content = this.nextElementSibling;
|
||||
@@ -42,9 +55,6 @@ for (i = 0; i < contents.length; i++) {
|
||||
//Add the button to the page and remove the header
|
||||
contents[i].parentNode.insertBefore(btn, contents[i]);
|
||||
contents[i].removeChild(element);
|
||||
}else{
|
||||
//reset span id if it isn't followed by Hx element
|
||||
spanElement.id = span_id;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user