setupTermynal() — fastapi Function Reference
Architecture documentation for the setupTermynal() function in custom.js from the fastapi codebase.
Entity Profile
Dependency Diagram
graph TD fc268481_6866_84e6_223f_81c319ddf971["setupTermynal()"] 49961dba_6b4d_9e52_de16_4ef5b04a5bea["custom.js"] fc268481_6866_84e6_223f_81c319ddf971 -->|defined in| 49961dba_6b4d_9e52_de16_4ef5b04a5bea 8d44dec4_66f2_396b_ce76_60bcbff6d1e8["main()"] 8d44dec4_66f2_396b_ce76_60bcbff6d1e8 -->|calls| fc268481_6866_84e6_223f_81c319ddf971 style fc268481_6866_84e6_223f_81c319ddf971 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
docs/en/docs/js/custom.js lines 1–113
function setupTermynal() {
document.querySelectorAll(".use-termynal").forEach(node => {
node.style.display = "block";
new Termynal(node, {
lineDelay: 500
});
});
const progressLiteralStart = "---> 100%";
const promptLiteralStart = "$ ";
const customPromptLiteralStart = "# ";
const termynalActivateClass = "termy";
let termynals = [];
function createTermynals() {
document
.querySelectorAll(`.${termynalActivateClass} .highlight code`)
.forEach(node => {
const text = node.textContent;
const lines = text.split("\n");
const useLines = [];
let buffer = [];
function saveBuffer() {
if (buffer.length) {
let isBlankSpace = true;
buffer.forEach(line => {
if (line) {
isBlankSpace = false;
}
});
dataValue = {};
if (isBlankSpace) {
dataValue["delay"] = 0;
}
if (buffer[buffer.length - 1] === "") {
// A last single <br> won't have effect
// so put an additional one
buffer.push("");
}
const bufferValue = buffer.join("<br>");
dataValue["value"] = bufferValue;
useLines.push(dataValue);
buffer = [];
}
}
for (let line of lines) {
if (line === progressLiteralStart) {
saveBuffer();
useLines.push({
type: "progress"
});
} else if (line.startsWith(promptLiteralStart)) {
saveBuffer();
const value = line.replace(promptLiteralStart, "").trimEnd();
useLines.push({
type: "input",
value: value
});
} else if (line.startsWith("// ")) {
saveBuffer();
const value = "💬 " + line.replace("// ", "").trimEnd();
useLines.push({
value: value,
class: "termynal-comment",
delay: 0
});
} else if (line.startsWith(customPromptLiteralStart)) {
saveBuffer();
const promptStart = line.indexOf(promptLiteralStart);
if (promptStart === -1) {
console.error("Custom prompt found but no end delimiter", line)
}
const prompt = line.slice(0, promptStart).replace(customPromptLiteralStart, "")
let value = line.slice(promptStart + promptLiteralStart.length);
useLines.push({
type: "input",
value: value,
prompt: prompt
});
} else {
buffer.push(line);
}
Domain
Subdomains
Defined In
Called By
Source
Frequently Asked Questions
What does setupTermynal() do?
setupTermynal() is a function in the fastapi codebase, defined in docs/en/docs/js/custom.js.
Where is setupTermynal() defined?
setupTermynal() is defined in docs/en/docs/js/custom.js at line 1.
What calls setupTermynal()?
setupTermynal() is called by 1 function(s): main.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free