mirror of
https://github.com/khoj-ai/khoj.git
synced 2025-02-17 08:04:21 +00:00
Minimal formatting to render beancount results legibly on web interface
This commit is contained in:
parent
a0759dd923
commit
3300378804
1 changed files with 13 additions and 1 deletions
|
@ -38,6 +38,12 @@
|
|||
}).join("\n"));
|
||||
}
|
||||
|
||||
function render_ledger(query, data) {
|
||||
return `<div id="results-ledger">` + data.map(function (item) {
|
||||
return `<p>${item.entry}</p>`
|
||||
}).join("\n") + `</div>`;
|
||||
}
|
||||
|
||||
function render_json(data, query, type) {
|
||||
if (type === "markdown") {
|
||||
return render_markdown(query, data);
|
||||
|
@ -47,6 +53,8 @@
|
|||
return render_org(query, data, "music-");
|
||||
} else if (type === "image") {
|
||||
return data.map(render_image).join('');
|
||||
} else if (type === "ledger") {
|
||||
return render_ledger(query, data);
|
||||
} else {
|
||||
return `<pre id="json">${JSON.stringify(data, null, 2)}</pre>`;
|
||||
}
|
||||
|
@ -223,7 +231,11 @@
|
|||
#json {
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
#results-markdown {
|
||||
#results-ledger {
|
||||
white-space: pre-line;
|
||||
text-align: left;
|
||||
}
|
||||
#results-markdown {
|
||||
text-align: left;
|
||||
}
|
||||
#results-music,
|
||||
|
|
Loading…
Add table
Reference in a new issue