mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-05-07 02:51:50 +00:00
chore: formatting etc
This commit is contained in:
parent
56a69e519b
commit
5a5d90c85a
14 changed files with 698 additions and 237 deletions
|
|
@ -147,37 +147,47 @@ export function Md({ compact, t, text }: { compact?: boolean; t: Theme; text: st
|
|||
|
||||
if (line.match(/^>\s?/)) {
|
||||
const quoteLines: string[] = []
|
||||
|
||||
while (i < lines.length && lines[i]!.match(/^>\s?/)) {
|
||||
quoteLines.push(lines[i]!.replace(/^>\s?/, ''))
|
||||
i++
|
||||
}
|
||||
|
||||
nodes.push(
|
||||
<Box flexDirection="column" key={key}>
|
||||
{quoteLines.map((ql, qi) => (
|
||||
<Text color={t.color.dim} key={qi}>
|
||||
{' │ '}<MdInline t={t} text={ql} />
|
||||
{' │ '}
|
||||
<MdInline t={t} text={ql} />
|
||||
</Text>
|
||||
))}
|
||||
</Box>
|
||||
)
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
if (line.includes('|') && line.trim().startsWith('|')) {
|
||||
const tableRows: string[][] = []
|
||||
|
||||
while (i < lines.length && lines[i]!.trim().startsWith('|')) {
|
||||
const row = lines[i]!.trim()
|
||||
|
||||
if (!/^[|\s:-]+$/.test(row)) {
|
||||
tableRows.push(
|
||||
row.split('|').filter(Boolean).map(c => c.trim())
|
||||
row
|
||||
.split('|')
|
||||
.filter(Boolean)
|
||||
.map(c => c.trim())
|
||||
)
|
||||
}
|
||||
|
||||
i++
|
||||
}
|
||||
|
||||
if (tableRows.length) {
|
||||
const widths = tableRows[0]!.map((_, ci) =>
|
||||
Math.max(...tableRows.map(r => (r[ci] ?? '').length))
|
||||
)
|
||||
const widths = tableRows[0]!.map((_, ci) => Math.max(...tableRows.map(r => (r[ci] ?? '').length)))
|
||||
|
||||
nodes.push(
|
||||
<Box flexDirection="column" key={key} paddingLeft={2}>
|
||||
{tableRows.map((row, ri) => (
|
||||
|
|
@ -188,6 +198,7 @@ export function Md({ compact, t, text }: { compact?: boolean; t: Theme; text: st
|
|||
</Box>
|
||||
)
|
||||
}
|
||||
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue