[READ-ONLY] Mirror of https://github.com/flo-bit/svleek. simple but beautiful documentation generator from markdown flo-bit.github.io/svleek/
documentation documentation-generator markdown svelte sveltekit tailwind
0

Configure Feed

Select the types of activity you want to include in your feed.

fix relative urls

+24 -12
+11 -2
build-docs.js
··· 37 37 addClassesToElement(element, 'mt-6 text-xl leading-8'); 38 38 }); 39 39 dom.window.document.querySelectorAll('img').forEach((element) => { 40 + // add base_url to src, if it doesn't start with http 41 + const src = element.getAttribute('src'); 42 + if (!src.startsWith('http')) element.setAttribute('src', config.base_url + src); 43 + 40 44 addClassesToElement(element, 'rounded-xl bg-neutral-50 dark:bg-neutral-950 object-cover'); 41 45 }); 42 46 dom.window.document.querySelectorAll('blockquote').forEach((element) => { ··· 46 50 ); 47 51 }); 48 52 dom.window.document.querySelectorAll('a').forEach((element) => { 53 + const href = element.getAttribute('href'); 54 + if (!href.startsWith('http')) element.setAttribute('href', config.base_url + href); 55 + 49 56 addClassesToElement( 50 57 element, 51 58 'font-semibold text-accent-600 hover:text-accent-500 dark:text-accent-500 dark:hover:text-accent-400' ··· 268 275 // replace - with space and turn the first letter to uppercase 269 276 title: fileName.replace(/-/g, ' ').replace(/^\w/, (c) => c.toUpperCase()), 270 277 // remove src/routes from the path 271 - href: newDestPath.replace(/^src\/routes/, '') 278 + href: config.base_url + newDestPath.replace(/^src\/routes/, '') 272 279 }; 273 280 if (parentMenu) { 274 281 parentMenu.children = parentMenu.children || []; ··· 351 358 const pageContent = fs.readFileSync(pagePath, 'utf-8'); 352 359 const newPageContent = pageContent.replace( 353 360 /<HeroScreenshot [\s|\S]*\/>/, 354 - `<HeroScreenshot title="${heroTitle}" subtitle="${heroSubtitle}" image="${heroScreenshot}" buttonHref="${heroButtonHref}" buttonLabel="${heroButtonLabel}"/>` 361 + `<HeroScreenshot title="${heroTitle}" subtitle="${heroSubtitle}" image="${heroScreenshot}" buttonHref="${ 362 + config.base_url + heroButtonHref 363 + }" buttonLabel="${heroButtonLabel}"/>` 355 364 ); 356 365 fs.writeFileSync(pagePath, newPageContent); 357 366 }
+1
docs/01-introduction.md
··· 31 31 32 32 ```json 33 33 { 34 + "base_url": "The base url of your github pages site", // e.g. "https://flo-bit.github.io/svleek" 34 35 "title": "Svleek", // sets the title of the main page 35 36 "subtitle": "Minimal, Beautiful, and Fast Documentation", // sets the subtitle of the main page 36 37 "image": "/screenshot.png", // sets the image of the main page
+2 -1
docs/svleek.config.json
··· 4 4 "image": "/screenshot.png", 5 5 "first_page": "/docs/introduction", 6 6 "button_label": "Read the docs!", 7 - "github": "https://github.com/", 7 + "base_url": "https://flo-bit.github.io/svleek", 8 + "github": "https://github.com/flo-bit/svleek", 8 9 "accent": "emerald" 9 10 }
+1 -1
src/lib/Github.svelte
··· 1 1 <script> 2 - let link = 'https://github.com/'; 2 + let link = 'https://github.com/flo-bit/svleek'; 3 3 </script> 4 4 5 5 <a href={link} target="_blank">
+1 -1
src/routes/+page.svelte
··· 2 2 import HeroScreenshot from '$lib/components/navigation/HeroScreenshot.svelte'; 3 3 </script> 4 4 5 - <HeroScreenshot title="Svleek" subtitle="Minimal, Beautiful, and Fast Documentation" image="/screenshot.png" buttonHref="/docs/introduction" buttonLabel="Read the docs!"/> 5 + <HeroScreenshot title="Svleek" subtitle="Minimal, Beautiful, and Fast Documentation" image="/screenshot.png" buttonHref="https://flo-bit.github.io/svleek/docs/introduction" buttonLabel="Read the docs!"/>
+5 -5
src/routes/docs/+layout.svelte
··· 26 26 let menu = [ 27 27 { 28 28 "title": "Introduction", 29 - "href": "/docs/introduction" 29 + "href": "https://flo-bit.github.io/svleek/docs/introduction" 30 30 }, 31 31 { 32 32 "title": "Test", 33 - "href": "/docs/test" 33 + "href": "https://flo-bit.github.io/svleek/docs/test" 34 34 }, 35 35 { 36 36 "title": "Navigation", 37 - "href": "/docs/navigation", 37 + "href": "https://flo-bit.github.io/svleek/docs/navigation", 38 38 "children": [ 39 39 { 40 40 "title": "Topic1", 41 - "href": "/docs/navigation/topic1" 41 + "href": "https://flo-bit.github.io/svleek/docs/navigation/topic1" 42 42 }, 43 43 { 44 44 "title": "Topic2", 45 - "href": "/docs/navigation/topic2" 45 + "href": "https://flo-bit.github.io/svleek/docs/navigation/topic2" 46 46 } 47 47 ] 48 48 }
+1 -1
src/routes/docs/test/+page.svelte
··· 1 1 <div class="px-6 py-16 lg:px-8 max-w-[100vw]"><div class="mx-auto max-w-3xl text-base leading-7 text-neutral-700 dark:text-neutral-300"><h1 class="mt-16 text-3xl font-bold tracking-tight text-neutral-900 dark:text-neutral-100 sm:text-4xl">Testing the documentation</h1> 2 2 <h3 class="mt-6 text-xl leading-8">This is a very important subheading, that can be used for important things or something. I'm not completely sure yet. But it is important.</h3> 3 - <p class="mt-6 leading-8">This is a <a href="/docs/introduction" class="font-semibold text-accent-600 hover:text-accent-500 dark:text-accent-500 dark:hover:text-accent-400">link</a></p> 3 + <p class="mt-6 leading-8">This is a <a href="https://flo-bit.github.io/svleek/docs/introduction" class="font-semibold text-accent-600 hover:text-accent-500 dark:text-accent-500 dark:hover:text-accent-400">link</a></p> 4 4 <h2 class="mt-16 text-2xl font-bold tracking-tight text-neutral-900 dark:text-neutral-100">List</h2> 5 5 <ul class="mt-8 space-y-4 text-neutral-600 dark:text-neutral-400"> 6 6 <li class="flex gap-x-3 items-start"><div class="mt-3 h-1.5 w-1.5 flex-none bg-accent-600 dark:bg-accent-500 rounded-full" aria-hidden="true"></div><span class="text-neutral-900 dark:text-neutral-100 font-semibold">This is a list</span></li>
+2 -1
static/svleek.config.json
··· 4 4 "image": "/screenshot.png", 5 5 "first_page": "/docs/introduction", 6 6 "button_label": "Read the docs!", 7 - "github": "https://github.com/", 7 + "base_url": "https://flo-bit.github.io/svleek", 8 + "github": "https://github.com/flo-bit/svleek", 8 9 "accent": "emerald" 9 10 }