mirror of
https://github.com/JonasunderscoreJones/wiki.jonasjones.dev.git
synced 2025-10-22 22:09:17 +02:00
Initial commit
This commit is contained in:
commit
09c002f1ae
25 changed files with 2255 additions and 0 deletions
12
.gitignore
vendored
Normal file
12
.gitignore
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
.DS_Store
|
||||||
|
node_modules
|
||||||
|
/build
|
||||||
|
/.svelte-kit
|
||||||
|
/package
|
||||||
|
.env
|
||||||
|
.env.*
|
||||||
|
!.env.example
|
||||||
|
.vercel
|
||||||
|
.output
|
||||||
|
vite.config.js.timestamp-*
|
||||||
|
vite.config.ts.timestamp-*
|
2
.npmrc
Normal file
2
.npmrc
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
engine-strict=true
|
||||||
|
resolution-mode=highest
|
4
README.md
Normal file
4
README.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# Svelte Markdown Wiki
|
||||||
|
A wiki template for SvelteKit that uses Markdown files for content.
|
||||||
|
|
||||||
|
Simply clone the template and edit it to your liking.
|
17
jsconfig.json
Normal file
17
jsconfig.json
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"extends": "./.svelte-kit/tsconfig.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"allowJs": true,
|
||||||
|
"checkJs": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"strict": true
|
||||||
|
}
|
||||||
|
// Path aliases are handled by https://kit.svelte.dev/docs/configuration#alias and https://kit.svelte.dev/docs/configuration#files
|
||||||
|
//
|
||||||
|
// If you want to overwrite includes/excludes, make sure to copy over the relevant includes/excludes
|
||||||
|
// from the referenced tsconfig.json - TypeScript does not merge them in
|
||||||
|
}
|
1851
package-lock.json
generated
Normal file
1851
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
31
package.json
Normal file
31
package.json
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
{
|
||||||
|
"name": "wiki.jonasjones.dev",
|
||||||
|
"version": "0.0.1",
|
||||||
|
"scripts": {
|
||||||
|
"dev": "vite dev",
|
||||||
|
"build": "vite build",
|
||||||
|
"preview": "vite preview",
|
||||||
|
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
|
||||||
|
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@fontsource/fira-mono": "^4.5.10",
|
||||||
|
"@neoconfetti/svelte": "^1.0.0",
|
||||||
|
"@sveltejs/adapter-auto": "^2.0.0",
|
||||||
|
"@sveltejs/kit": "^1.20.4",
|
||||||
|
"@types/cookie": "^0.5.1",
|
||||||
|
"mdsvex": "^0.11.0",
|
||||||
|
"sass": "^1.67.0",
|
||||||
|
"svelte": "^4.0.5",
|
||||||
|
"svelte-check": "^3.4.3",
|
||||||
|
"svelte-preprocess": "^5.0.4",
|
||||||
|
"typescript": "^5.0.0",
|
||||||
|
"vite": "^4.4.2"
|
||||||
|
},
|
||||||
|
"type": "module",
|
||||||
|
"dependencies": {
|
||||||
|
"@sveltejs/adapter-cloudflare": "^2.3.3",
|
||||||
|
"@sveltejs/adapter-static": "^2.0.3",
|
||||||
|
"marked": "^9.0.0"
|
||||||
|
}
|
||||||
|
}
|
12
src/app.d.ts
vendored
Normal file
12
src/app.d.ts
vendored
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
// See https://kit.svelte.dev/docs/types#app
|
||||||
|
// for information about these interfaces
|
||||||
|
declare global {
|
||||||
|
namespace App {
|
||||||
|
// interface Error {}
|
||||||
|
// interface Locals {}
|
||||||
|
// interface PageData {}
|
||||||
|
// interface Platform {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {};
|
12
src/app.html
Normal file
12
src/app.html
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
|
||||||
|
<meta name="viewport" content="width=device-width" />
|
||||||
|
%sveltekit.head%
|
||||||
|
</head>
|
||||||
|
<body data-sveltekit-preload-data="hover">
|
||||||
|
<div style="display: contents">%sveltekit.body%</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
37
src/lib/components/Footer.svelte
Normal file
37
src/lib/components/Footer.svelte
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
<!-- Footer.svelte -->
|
||||||
|
<footer>
|
||||||
|
<a href="/">Home</a>
|
||||||
|
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/about">About</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/contact">Contact</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</footer>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
footer {
|
||||||
|
padding: 1rem;
|
||||||
|
background: lightskyblue;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
margin: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
</style>
|
36
src/lib/components/Header.svelte
Normal file
36
src/lib/components/Header.svelte
Normal file
|
@ -0,0 +1,36 @@
|
||||||
|
<!-- Header.svelte -->
|
||||||
|
<header>
|
||||||
|
<a href="/"><img src="/favicon.png" alt="logo" width="50" height="50" /></a>
|
||||||
|
<nav>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
<a href="/about">About</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="/contact">Contact</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
header {
|
||||||
|
padding: 1rem;
|
||||||
|
background: lightskyblue;
|
||||||
|
display: flex;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
margin: 0;
|
||||||
|
list-style-type: none;
|
||||||
|
display: flex;
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: inherit;
|
||||||
|
}
|
||||||
|
</style>
|
49
src/lib/components/Navbar.svelte
Normal file
49
src/lib/components/Navbar.svelte
Normal file
|
@ -0,0 +1,49 @@
|
||||||
|
<script>
|
||||||
|
let data = import.meta.glob('/src/routes/**/+page.md');
|
||||||
|
let paths = data;
|
||||||
|
|
||||||
|
function buildHierarchy(paths) {
|
||||||
|
const nestedList = {};
|
||||||
|
let fixedpaths = [];
|
||||||
|
let fixedpaths2 = [];
|
||||||
|
fixedpaths = Object.keys(paths);
|
||||||
|
fixedpaths.forEach((path) => {
|
||||||
|
const fixedpath = path.replace("/+page.md", "").replace("/src/routes", "");
|
||||||
|
fixedpaths2.push(fixedpath);
|
||||||
|
});
|
||||||
|
fixedpaths2.forEach((folder) => {
|
||||||
|
const parts = folder.split('/').filter(Boolean);
|
||||||
|
let currentNode = nestedList;
|
||||||
|
|
||||||
|
parts.forEach((part) => {
|
||||||
|
if (!currentNode[part]) {
|
||||||
|
currentNode[part] = {};
|
||||||
|
}
|
||||||
|
currentNode = currentNode[part];
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
return nestedList;
|
||||||
|
}
|
||||||
|
|
||||||
|
const nestedFolders = buildHierarchy(paths);
|
||||||
|
|
||||||
|
// Helper function to recursively render the nested list
|
||||||
|
function renderNestedList(node, prefix = '') {
|
||||||
|
return Object.keys(node).map((key) => {
|
||||||
|
const fullPath = `${prefix}/${key}`;
|
||||||
|
return `<li><a href="${fullPath}">${key}</a><ul>${renderNestedList(node[key], fullPath)}</ul></li>`;
|
||||||
|
}).join('');
|
||||||
|
}
|
||||||
|
|
||||||
|
const renderedList = `<ul>${renderNestedList(nestedFolders)}</ul>`;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-12">
|
||||||
|
<h1>Pages</h1>
|
||||||
|
{@html renderedList}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
34
src/lib/styles/style.css
Normal file
34
src/lib/styles/style.css
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
/* style.css */
|
||||||
|
body {
|
||||||
|
margin: 0;
|
||||||
|
background: #eee;
|
||||||
|
color: #333;
|
||||||
|
font-family: sans-serif;
|
||||||
|
}
|
||||||
|
|
||||||
|
main {
|
||||||
|
padding: 1rem;
|
||||||
|
margin: 2rem auto;
|
||||||
|
max-width: 40rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.column {
|
||||||
|
float: left;
|
||||||
|
padding: 10px;
|
||||||
|
height: auto;
|
||||||
|
display: table-cell;
|
||||||
|
}
|
||||||
|
|
||||||
|
.navbar {
|
||||||
|
border-right: black solid 1px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.container {
|
||||||
|
display: table;
|
||||||
|
}
|
||||||
|
|
||||||
|
.row:after {
|
||||||
|
content: "";
|
||||||
|
display: table;
|
||||||
|
clear: both;
|
||||||
|
}
|
15
src/lib/utils/index.js
Normal file
15
src/lib/utils/index.js
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
export const fetchMarkdownPages = async () => {
|
||||||
|
const allPageFiles = import.meta.glob('/src/routes/**/+page.md');
|
||||||
|
const iterablePageFiles = Object.entries(allPageFiles);
|
||||||
|
const allPages = await Promise.all(
|
||||||
|
iterablePageFiles.map(async ([path]) => {
|
||||||
|
const pagePath = path.slice(11, -3);
|
||||||
|
|
||||||
|
return {
|
||||||
|
path: pagePath
|
||||||
|
};
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
|
return allPages;
|
||||||
|
};
|
22
src/routes/+layout.svelte
Normal file
22
src/routes/+layout.svelte
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
<script>
|
||||||
|
import Header from '$lib/components/Header.svelte';
|
||||||
|
import Footer from '$lib/components/Footer.svelte';
|
||||||
|
import Navbar from '$lib/components/Navbar.svelte';
|
||||||
|
import '$lib/styles/style.css';
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Header />
|
||||||
|
|
||||||
|
<div class="container">
|
||||||
|
<div class="column navbar"><Navbar /></div>
|
||||||
|
<div class="column content">
|
||||||
|
<main>
|
||||||
|
<slot />
|
||||||
|
</main>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<Footer />
|
65
src/routes/+page.md
Normal file
65
src/routes/+page.md
Normal file
|
@ -0,0 +1,65 @@
|
||||||
|
# Welcome to the Svelte Markdown Wiki!
|
||||||
|
|
||||||
|
Every page here is a Markdown file. Svelte does the rest!
|
||||||
|
|
||||||
|
---
|
||||||
|
## Different headers
|
||||||
|
### Even smaller header
|
||||||
|
|
||||||
|
You can use **bold**, *italic*, and ~~strikethrough~~ text.
|
||||||
|
|
||||||
|
You can also use [links](/).
|
||||||
|
|
||||||
|
You can use `code` blocks.
|
||||||
|
|
||||||
|
You can use tables:
|
||||||
|
|
||||||
|
| Header 1 | Header 2 |
|
||||||
|
| -------- | -------- |
|
||||||
|
| Cell 1 | Cell 2 |
|
||||||
|
|
||||||
|
You can use blockquotes:
|
||||||
|
|
||||||
|
> This is a blockquote.
|
||||||
|
> It can span multiple lines.
|
||||||
|
> > You can even nest blockquotes.
|
||||||
|
> > > And nest them deeper.
|
||||||
|
> > > > And deeper.
|
||||||
|
> > > > > And deeper.
|
||||||
|
|
||||||
|
You can use horizontal rules:
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
You can use ordered lists:
|
||||||
|
|
||||||
|
1. Item 1
|
||||||
|
2. Item 2
|
||||||
|
3. Item 3
|
||||||
|
1. Item 3.1
|
||||||
|
2. Item 3.2
|
||||||
|
4. Item 4
|
||||||
|
5. Item 5
|
||||||
|
|
||||||
|
You can use unordered lists:
|
||||||
|
|
||||||
|
- Item 1
|
||||||
|
- Item 2
|
||||||
|
- Item 3
|
||||||
|
- Item 3.1
|
||||||
|
- Item 3.2
|
||||||
|
- Item 4
|
||||||
|
- Item 5
|
||||||
|
|
||||||
|
|
||||||
|
You can use codeblocks:
|
||||||
|
|
||||||
|
```js
|
||||||
|
const foo = 'bar';
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
You can use images:
|
||||||
|
|
||||||
|

|
2
src/routes/Exampletopic/+page.md
Normal file
2
src/routes/Exampletopic/+page.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Exampletopic
|
||||||
|
This is an example topic.
|
2
src/routes/Exampletopic/Introduction/+page.md
Normal file
2
src/routes/Exampletopic/Introduction/+page.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Introduction
|
||||||
|
This is the introduction.
|
2
src/routes/Exampletopic/Introduction/Q&A/+page.md
Normal file
2
src/routes/Exampletopic/Introduction/Q&A/+page.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# Q & A
|
||||||
|
This is an example Q&A page
|
10
src/routes/__internal_api/+server.js
Normal file
10
src/routes/__internal_api/+server.js
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
import { fetchMarkdownPages } from '$lib/utils';
|
||||||
|
import { json } from '@sveltejs/kit';
|
||||||
|
|
||||||
|
export const GET = async () => {
|
||||||
|
const allPosts = await fetchMarkdownPages();
|
||||||
|
// sort posts alphabetically
|
||||||
|
allPosts.sort((a, b) => a.path.localeCompare(b.path));
|
||||||
|
|
||||||
|
return json(allPosts);
|
||||||
|
};
|
5
src/routes/about/+page.md
Normal file
5
src/routes/about/+page.md
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# About
|
||||||
|
|
||||||
|
A Wiki Template by Jonas_Jones
|
||||||
|
|
||||||
|
[GitHub Repository](https://github.com/J-onasJones/SvelteMarkdownWiki)
|
3
src/routes/contact/+page.md
Normal file
3
src/routes/contact/+page.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# Contact
|
||||||
|
|
||||||
|
This is the contact page.
|
BIN
static/favicon.png
Normal file
BIN
static/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 87 KiB |
3
static/robots.txt
Normal file
3
static/robots.txt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
# https://www.robotstxt.org/robotstxt.html
|
||||||
|
User-agent: *
|
||||||
|
Disallow:
|
23
svelte.config.js
Normal file
23
svelte.config.js
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
//import adapter from '@sveltejs/adapter-auto';
|
||||||
|
import sveltePreprocess from 'svelte-preprocess';
|
||||||
|
import adapter from '@sveltejs/adapter-cloudflare';
|
||||||
|
import { mdsvex } from 'mdsvex';
|
||||||
|
|
||||||
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
|
const config = {
|
||||||
|
kit: {
|
||||||
|
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||||
|
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
||||||
|
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||||
|
adapter: adapter()
|
||||||
|
},
|
||||||
|
extensions: ['.svelte', '.md'],
|
||||||
|
preprocess: [
|
||||||
|
sveltePreprocess(),
|
||||||
|
mdsvex({
|
||||||
|
extensions: ['.md']
|
||||||
|
})
|
||||||
|
]
|
||||||
|
};
|
||||||
|
|
||||||
|
export default config;
|
6
vite.config.js
Normal file
6
vite.config.js
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
import { sveltekit } from '@sveltejs/kit/vite';
|
||||||
|
import { defineConfig } from 'vite';
|
||||||
|
|
||||||
|
export default defineConfig({
|
||||||
|
plugins: [sveltekit()]
|
||||||
|
});
|
Loading…
Add table
Add a link
Reference in a new issue