Compare commits

...

2 Commits

Author SHA1 Message Date
Norman Köhring 12678fe115 update readme 6 months ago
Norman Köhring 2bfb113266 feat: consider max width for rendering figlet 6 months ago

@ -19,7 +19,9 @@ const footer = ref([])
const figlet = useFiglet() const figlet = useFiglet()
function getHeaderArt(header: string, font: string) { function getHeaderArt(header: string, font: string) {
return figlet.render(header, font) // Why is that so simple to approximate? Pretty sure, there is a mistake somewhere...
const maxWidth = Math.round(textArea.value?.getBoundingClientRect().width / 10) - 2
return figlet.render(header, font, maxWidth)
} }
function parsedContent(src: string) { function parsedContent(src: string) {
@ -42,7 +44,7 @@ function getCurrentPage(title: string) {
console.error('☠️ current page not found in the list. This should never happen.') console.error('☠️ current page not found in the list. This should never happen.')
return { return {
title: 'not_found', title: 'not_found',
headerArt: getTitleArt('not_found'), headerArt: getHeaderArt('404', 'chunky'),
content: 'The page could not be found.', content: 'The page could not be found.',
uris: [], uris: [],
} }

@ -22,7 +22,8 @@ function getFont(name: string) {
export default function useFiglet() { export default function useFiglet() {
const flm = new FontLayoutManager() const flm = new FontLayoutManager()
function render(text: string, fontName: string) { function render(text: string, fontName: string, maxWidth: number) {
flm.width.set(maxWidth)
const figFont = getFont(fontName) const figFont = getFont(fontName)
const output = flm.renderText(text, figFont) const output = flm.renderText(text, figFont)
return output return output

@ -16,19 +16,20 @@ The ascii art headers are generated with `figlet`, using the [Chunky](https://gi
k0r.386 offers some old-school goodness, paired with modern features where convenience matters. k0r.386 offers some old-school goodness, paired with modern features where convenience matters.
Notable features are: ### Notable features
* ASCII Art Titles, auto generated by Figlet.js * Interactive prompt, for the old-school terminal feeling
* Automatic page discovery * Automatic page discovery
* Footer with clickable links, that can be set up per command (for example an "about" command could add an email link) or per page (configurable in frontmatter) * Footer with clickable links, that can be set up per command (for example an "about" command could add an email link) or per page (configurable in frontmatter)
* Interactive prompt, for the old-school terminal feeling * ASCII Art Titles, auto generated with [figlet-ts](https://github.com/figlet-ts/figlet-ts/), with per page configurable font (defaults to "Chunky").
Planned features are: ### Planned features
* Slow text output, the real retro deal * Slow text output, the real retro deal
* Pagination (`more`-style) * Pagination (`more`-style)
Anti-features (what you will not find as part of this theme): ### Anti-features
*(what you will not find as part of this theme)*
* Text formatting * Text formatting
* Syntax highlighting * Syntax highlighting

Loading…
Cancel
Save