diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | index.ts | 45 | ||||
-rw-r--r-- | package.json | 18 | ||||
-rw-r--r-- | pnpm-lock.yaml | 230 | ||||
-rw-r--r-- | posts/adultporn.png | bin | 0 -> 291210 bytes | |||
-rw-r--r-- | posts/my-first-felony.md | 11 | ||||
-rw-r--r-- | tsconfig.json | 9 |
7 files changed, 316 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..bb64915 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +node_modules +build + diff --git a/index.ts b/index.ts new file mode 100644 index 0000000..eadab52 --- /dev/null +++ b/index.ts @@ -0,0 +1,45 @@ +import showdown from "showdown"; +import yaml from "yaml"; +import { promises as fs } from "fs"; + +const posts = await fs.readdir("posts"); + +function splitPostHeader(postData: string): [string, string] { + if (postData.startsWith("---\n")) { + const headerEndIndex = postData.indexOf("\n---\n", 4); + + return [ + postData.substring(4, headerEndIndex), + postData.substring(headerEndIndex + 5), + ]; + } + return ["", postData]; +} + +await fs.rm("build", { recursive: true }); +await fs.mkdir("build"); + +for (let postPath of posts) { + const totalPostPath = `posts/${postPath}`; + if (!postPath.endsWith(".md")) { + await fs.copyFile(totalPostPath, `build/${postPath}`); + continue; + } + const postText = await fs.readFile(totalPostPath, { encoding: "utf-8" }); + const [postHeader, postBody] = splitPostHeader(postText); + const postMetadata = yaml.parse(postHeader); + const converter = new showdown.Converter(); + const htmlBody = converter.makeHtml(postBody); + + const primitiveHtmlDocument = ` +<html> + <head> + <title>${postMetadata.name}</title> + </head> + <body> + ${htmlBody} + </body> +</html>`; + const targetPath = `build/${postPath.replace(".md", ".html")}`; + fs.writeFile(targetPath, primitiveHtmlDocument, { encoding: "utf-8" }); +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..1578ee9 --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "dependencies": { + "showdown": "^2.1.0", + "typescript": "^5.1.6", + "yaml": "^2.3.1" + }, + "type": "module", + "scripts": { + "build": "ts-node --esm index.ts" + }, + "devDependencies": { + "@types/node": "^18.13.0", + "@types/showdown": "^2.0.1", + "ts-node": "^10.9.1" + }, + "target": "es2017", + "module": "system" +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml new file mode 100644 index 0000000..39d8b4c --- /dev/null +++ b/pnpm-lock.yaml @@ -0,0 +1,230 @@ +lockfileVersion: "6.0" + +dependencies: + showdown: + specifier: ^2.1.0 + version: 2.1.0 + typescript: + specifier: ^5.1.6 + version: 5.1.6 + yaml: + specifier: ^2.3.1 + version: 2.3.1 + +devDependencies: + "@types/node": + specifier: ^18.13.0 + version: 18.13.0 + "@types/showdown": + specifier: ^2.0.1 + version: 2.0.1 + ts-node: + specifier: ^10.9.1 + version: 10.9.1(@types/node@18.13.0)(typescript@5.1.6) + +packages: + /@cspotcode/source-map-support@0.8.1: + resolution: + { + integrity: sha512-IchNf6dN4tHoMFIn/7OE8LWZ19Y6q/67Bmf6vnGREv8RSbBVb9LPJxEcnwrcwX6ixSvaiGoomAUvu4YSxXrVgw==, + } + engines: { node: ">=12" } + dependencies: + "@jridgewell/trace-mapping": 0.3.9 + dev: true + + /@jridgewell/resolve-uri@3.1.1: + resolution: + { + integrity: sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==, + } + engines: { node: ">=6.0.0" } + dev: true + + /@jridgewell/sourcemap-codec@1.4.15: + resolution: + { + integrity: sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==, + } + dev: true + + /@jridgewell/trace-mapping@0.3.9: + resolution: + { + integrity: sha512-3Belt6tdc8bPgAtbcmdtNJlirVoTmEb5e2gC94PnkwEW9jI6CAHUeoG85tjWP5WquqfavoMtMwiG4P926ZKKuQ==, + } + dependencies: + "@jridgewell/resolve-uri": 3.1.1 + "@jridgewell/sourcemap-codec": 1.4.15 + dev: true + + /@tsconfig/node10@1.0.9: + resolution: + { + integrity: sha512-jNsYVVxU8v5g43Erja32laIDHXeoNvFEpX33OK4d6hljo3jDhCBDhx5dhCCTMWUojscpAagGiRkBKxpdl9fxqA==, + } + dev: true + + /@tsconfig/node12@1.0.11: + resolution: + { + integrity: sha512-cqefuRsh12pWyGsIoBKJA9luFu3mRxCA+ORZvA4ktLSzIuCUtWVxGIuXigEwO5/ywWFMZ2QEGKWvkZG1zDMTag==, + } + dev: true + + /@tsconfig/node14@1.0.3: + resolution: + { + integrity: sha512-ysT8mhdixWK6Hw3i1V2AeRqZ5WfXg1G43mqoYlM2nc6388Fq5jcXyr5mRsqViLx/GJYdoL0bfXD8nmF+Zn/Iow==, + } + dev: true + + /@tsconfig/node16@1.0.4: + resolution: + { + integrity: sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==, + } + dev: true + + /@types/node@18.13.0: + resolution: + { + integrity: sha512-gC3TazRzGoOnoKAhUx+Q0t8S9Tzs74z7m0ipwGpSqQrleP14hKxP4/JUeEQcD3W1/aIpnWl8pHowI7WokuZpXg==, + } + dev: true + + /@types/showdown@2.0.1: + resolution: + { + integrity: sha512-xdnAw2nFqomkaL0QdtEk0t7yz26UkaVPl4v1pYJvtE1T0fmfQEH3JaxErEhGByEAl3zUZrkNBlneuJp0WJGqEA==, + } + dev: true + + /acorn-walk@8.2.0: + resolution: + { + integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==, + } + engines: { node: ">=0.4.0" } + dev: true + + /acorn@8.10.0: + resolution: + { + integrity: sha512-F0SAmZ8iUtS//m8DmCTA0jlh6TDKkHQyK6xc6V4KDTyZKA9dnvX9/3sRTVQrWm79glUAZbnmmNcdYwUIHWVybw==, + } + engines: { node: ">=0.4.0" } + hasBin: true + dev: true + + /arg@4.1.3: + resolution: + { + integrity: sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA==, + } + dev: true + + /commander@9.5.0: + resolution: + { + integrity: sha512-KRs7WVDKg86PWiuAqhDrAQnTXZKraVcCc6vFdL14qrZ/DcWwuRo7VoiYXalXO7S5GKpqYiVEwCbgFDfxNHKJBQ==, + } + engines: { node: ^12.20.0 || >=14 } + dev: false + + /create-require@1.1.1: + resolution: + { + integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==, + } + dev: true + + /diff@4.0.2: + resolution: + { + integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==, + } + engines: { node: ">=0.3.1" } + dev: true + + /make-error@1.3.6: + resolution: + { + integrity: sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw==, + } + dev: true + + /showdown@2.1.0: + resolution: + { + integrity: sha512-/6NVYu4U819R2pUIk79n67SYgJHWCce0a5xTP979WbNp0FL9MN1I1QK662IDU1b6JzKTvmhgI7T7JYIxBi3kMQ==, + } + hasBin: true + dependencies: + commander: 9.5.0 + dev: false + + /ts-node@10.9.1(@types/node@18.13.0)(typescript@5.1.6): + resolution: + { + integrity: sha512-NtVysVPkxxrwFGUUxGYhfux8k78pQB3JqYBXlLRZgdGUqTO5wU/UyHop5p70iEbGhB7q5KmiZiU0Y3KlJrScEw==, + } + hasBin: true + peerDependencies: + "@swc/core": ">=1.2.50" + "@swc/wasm": ">=1.2.50" + "@types/node": "*" + typescript: ">=2.7" + peerDependenciesMeta: + "@swc/core": + optional: true + "@swc/wasm": + optional: true + dependencies: + "@cspotcode/source-map-support": 0.8.1 + "@tsconfig/node10": 1.0.9 + "@tsconfig/node12": 1.0.11 + "@tsconfig/node14": 1.0.3 + "@tsconfig/node16": 1.0.4 + "@types/node": 18.13.0 + acorn: 8.10.0 + acorn-walk: 8.2.0 + arg: 4.1.3 + create-require: 1.1.1 + diff: 4.0.2 + make-error: 1.3.6 + typescript: 5.1.6 + v8-compile-cache-lib: 3.0.1 + yn: 3.1.1 + dev: true + + /typescript@5.1.6: + resolution: + { + integrity: sha512-zaWCozRZ6DLEWAWFrVDz1H6FVXzUSfTy5FUMWsQlU8Ym5JP9eO4xkTIROFCQvhQf61z6O/G6ugw3SgAnvvm+HA==, + } + engines: { node: ">=14.17" } + hasBin: true + + /v8-compile-cache-lib@3.0.1: + resolution: + { + integrity: sha512-wa7YjyUGfNZngI/vtK0UHAN+lgDCxBPCylVXGp0zu59Fz5aiGtNXaq3DhIov063MorB+VfufLh3JlF2KdTK3xg==, + } + dev: true + + /yaml@2.3.1: + resolution: + { + integrity: sha512-2eHWfjaoXgTBC2jNM1LRef62VQa0umtvRiDSk6HSzW7RvS5YtkabJrwYLLEKWBc8a5U2PTSCs+dJjUTJdlHsWQ==, + } + engines: { node: ">= 14" } + dev: false + + /yn@3.1.1: + resolution: + { + integrity: sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==, + } + engines: { node: ">=6" } + dev: true diff --git a/posts/adultporn.png b/posts/adultporn.png Binary files differnew file mode 100644 index 0000000..f702b59 --- /dev/null +++ b/posts/adultporn.png diff --git a/posts/my-first-felony.md b/posts/my-first-felony.md new file mode 100644 index 0000000..08a9f58 --- /dev/null +++ b/posts/my-first-felony.md @@ -0,0 +1,11 @@ +--- +name: "whatever" + +date: today +--- + +# My first felony + +Hey everyone, it is I, _ECHO_, and I am a hardened criminal. For example: I use and distribute normal porn. Yes. Definitely normal porn. + +Here see some of my work for reference: ![adult porn](./adultporn.png) diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..f3ea3a4 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,9 @@ +{ + "target": "ES2017", + "compilerOptions": { + "module": "NodeNext", + "esModuleInterop": true, + "target": "ESNext", + "resolveJsonModule": true + } +} |