diff --git a/lib/docs/index.html b/lib/docs/index.html index 52012cad2f..8bf527999e 100644 --- a/lib/docs/index.html +++ b/lib/docs/index.html @@ -266,6 +266,42 @@ font-weight: bold; } + details[open] summary .sum-less { + display: none; + } + + details[open] summary .sum-more { + display: block; + } + + details summary .sum-more { + display: none; + } + + details summary { + list-style-type: none; + position: relative; + pointer-events: none; + } + + details summary::before { + content: "[+] "; + font-family: var(--mono); + color: var(--link-color); + position: sticky; + float: left; + top: 0px; + right: -16px; + z-index: 1; + margin-left: -2em; + pointer-events: all; + cursor: pointer; + } + + details[open] summary::before { + content: "[-] "; + } + .examples { list-style-type: none; margin: 0; diff --git a/lib/docs/main.js b/lib/docs/main.js index 4604744012..32ef68c572 100644 --- a/lib/docs/main.js +++ b/lib/docs/main.js @@ -2466,9 +2466,19 @@ var zigAnalysis; let docs = getAstNode(decl.src).docs; if (docs != null) { - tdDesc.innerHTML = shortDescMarkdown(docs); + docs = docs.trim(); + var short = shortDesc(docs); + if (short != docs) { + short = markdown(short); + var long = markdown(docs); + tdDesc.innerHTML = + "
" + short + "
" + "
" + long + "
"; + } + else { + tdDesc.innerHTML = markdown(short); + } } else { - tdDesc.textContent = ""; + tdDesc.innerHTML = "

No documentation provided.

"; } } domSectFns.classList.remove("hidden"); @@ -2897,7 +2907,7 @@ var zigAnalysis; }); } - function shortDescMarkdown(docs) { + function shortDesc(docs){ const trimmed_docs = docs.trim(); let index = trimmed_docs.indexOf("\n\n"); let cut = false; @@ -2913,7 +2923,11 @@ var zigAnalysis; let slice = trimmed_docs.slice(0, index); if (cut) slice += "..."; - return markdown(slice); + return slice; + } + + function shortDescMarkdown(docs) { + return markdown(shortDesc(docs)); } function markdown(input) { @@ -3110,6 +3124,13 @@ var zigAnalysis; } flushRun(); + if (in_code) { + in_code = false; + parsing_code = false; + innerHTML += ""; + codetag = ""; + } + while (stack.length > 0) { const fmt = stack.pop(); innerHTML += "";