From f00515e4c3cb98b7ed94c8a9a8a71b8535149b49 Mon Sep 17 00:00:00 2001 From: Hadi <112569860+anotherhadi@users.noreply.github.com> Date: Mon, 27 Apr 2026 23:12:57 +0200 Subject: [PATCH] Testing on notes Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com> --- src/components/NoteVars.astro | 110 ++++++++++++++++ src/content/notes/nmap.md | 6 + src/content/notes/test2.md | 14 ++ src/content/notes/test3.md | 14 ++ src/pages/notes/[...slug].astro | 221 +++++++++++++++++--------------- src/pages/notes/index.astro | 36 ++---- src/styles/global.css | 6 +- todolist.txt | 3 + 8 files changed, 277 insertions(+), 133 deletions(-) create mode 100644 src/components/NoteVars.astro create mode 100644 src/content/notes/test2.md create mode 100644 src/content/notes/test3.md create mode 100644 todolist.txt diff --git a/src/components/NoteVars.astro b/src/components/NoteVars.astro new file mode 100644 index 0000000..53a4b52 --- /dev/null +++ b/src/components/NoteVars.astro @@ -0,0 +1,110 @@ +--- +interface Props { + vars: string[]; +} + +const { vars } = Astro.props; +--- + +{ + vars.length > 0 && ( + <> + + + + + + + + ) +} + + diff --git a/src/content/notes/nmap.md b/src/content/notes/nmap.md index 50a8805..9f1b600 100644 --- a/src/content/notes/nmap.md +++ b/src/content/notes/nmap.md @@ -6,3 +6,9 @@ publishDate: 2026-04-24 --- ## Notes + +Salut comment ça va ! $test1 + +```bash +nmap -p $port "$Ip" +``` diff --git a/src/content/notes/test2.md b/src/content/notes/test2.md new file mode 100644 index 0000000..413e3b4 --- /dev/null +++ b/src/content/notes/test2.md @@ -0,0 +1,14 @@ +--- +title: "test2" +description: "" +tags: [] +publishDate: 2026-04-24 +--- + +## Notes + +Salut comment ça va ! $test1 + +```bash +nmap -p $test2 "$test3$test4" +``` diff --git a/src/content/notes/test3.md b/src/content/notes/test3.md new file mode 100644 index 0000000..84f4507 --- /dev/null +++ b/src/content/notes/test3.md @@ -0,0 +1,14 @@ +--- +title: "Bla blablalbal ae aetnaekjta ektae ktklaaek ljbtaekjb taekbt akejbt" +description: "lorem est seot nopsejt soejtosehtose ose toiseht jophs etosh etoshte osehtosht oshe topsh etopshiospehitopsehti." +tags: ["test", "test1", "test2"] +publishDate: 2026-04-24 +--- + +## Notes + +Salut comment ça va ! $test1 + +```bash +nmap -p $port "$Ip" +``` diff --git a/src/pages/notes/[...slug].astro b/src/pages/notes/[...slug].astro index 57556d1..a808d3f 100644 --- a/src/pages/notes/[...slug].astro +++ b/src/pages/notes/[...slug].astro @@ -1,8 +1,9 @@ --- import { getCollection, render } from "astro:content"; import Layout from "../../layouts/Layout.astro"; -import { Shield, ChevronLeft, List, PanelRight } from "@lucide/astro"; +import { List, PanelRight } from "@lucide/astro"; import Author from "../../components/Author.astro"; +import NoteVars from "../../components/NoteVars.astro"; import { getCategory, extractInlineHashtags } from "../../utils/notes"; export async function getStaticPaths() { @@ -69,6 +70,15 @@ function slugify(text: string) { .replace(/ +/g, "-"); } +const noteVars = [ + ...new Set( + Array.from( + (entry.body ?? "").matchAll(/\$([a-zA-Z_][a-zA-Z0-9_]*)/g), + (m) => m[1], + ), + ), +]; + const headings: { depth: number; text: string; id: string }[] = []; const headingRe = /^(#{2,4}) (.+)$/gm; let hm; @@ -91,6 +101,26 @@ while ((hm = headingRe.exec(entry.body ?? "")) !== null) { top: 3rem; height: calc(100vh - 3rem); } + + /* DaisyUI .menu forces width:fit-content and display:grid on items. + Astro scoped styles add [data-astro-cid-*] which raises specificity above DaisyUI's class selectors. */ + .nav-sidebar { + width: 100%; + } + + .nav-sidebar a { + display: flex; + overflow: hidden; + min-width: 0; + } + + .nav-sidebar a span { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + min-width: 0; + flex: 1; + }
-
+
- - Notes - +
+
-
- - / - {getCategory(entry)} - - · - -

{entry.data.title}

@@ -161,7 +179,7 @@ while ((hm = headingRe.exec(entry.body ?? "")) !== null) { {entry.data.tags.map((tag) => ( {tag} @@ -171,41 +189,36 @@ while ((hm = headingRe.exec(entry.body ?? "")) !== null) { }
-
- { headings.length > 0 && ( -
- + +
§ - table of contents - + - -
- -
+ table of contents +
+
+ +
+
) } @@ -220,8 +233,8 @@ while ((hm = headingRe.exec(entry.body ?? "")) !== null) { [&_ul_li]:before:content-['–'] [&_ul_li]:before:text-base-content/25 [&_ul_li]:before:mr-2 [&_ul_li]:before:font-mono [&_ol]:mb-4 [&_ol]:ml-5 [&_ol]:list-decimal [&_ol]:space-y-1 [&_li]:text-base-content/75 - [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:font-mono [&_code]:text-xs [&_code]:bg-base-200 [&_code]:text-primary/80 [&_code]:border [&_code]:border-base-300/50 - [&_pre]:p-4 [&_pre]:overflow-x-auto [&_pre]:mb-4 [&_pre]:bg-base-200/60 [&_pre]:border [&_pre]:border-base-300/50 [&_pre]:text-xs + [&_code]:px-1.5 [&_code]:py-0.5 [&_code]:rounded-field [&_code]:font-mono [&_code]:text-xs [&_code]:bg-base-200 [&_code]:text-primary/80 [&_code]:border [&_code]:border-base-300/50 + [&_pre]:p-4 [&_pre]:overflow-x-auto [&_pre]:mb-4 [&_pre]:rounded-box [&_pre]:bg-base-200/60 [&_pre]:border [&_pre]:border-base-300/50 [&_pre]:text-xs [&_pre_code]:bg-transparent [&_pre_code]:border-0 [&_pre_code]:p-0 [&_pre_code]:text-base-content/80 [&_blockquote]:border-l-2 [&_blockquote]:border-primary/25 [&_blockquote]:pl-4 [&_blockquote]:italic [&_blockquote]:my-4 [&_blockquote]:text-base-content/50 [&_table]:w-full [&_table]:mb-6 [&_table]:text-xs [&_table]:border-collapse @@ -255,65 +268,53 @@ while ((hm = headingRe.exec(entry.body ?? "")) !== null) { class="w-56 flex flex-col border-r border-base-300/60 h-full" style="background: oklch(4% 0 0);" > -
- - - - security notes - - -
- +
+
+
- +
@@ -404,7 +405,15 @@ while ((hm = headingRe.exec(entry.body ?? "")) !== null) { ) } -
+
+ +
+
diff --git a/src/pages/notes/index.astro b/src/pages/notes/index.astro index 66cca06..1d1ed43 100644 --- a/src/pages/notes/index.astro +++ b/src/pages/notes/index.astro @@ -25,31 +25,17 @@ const searchIndex = Object.fromEntries( >
-
- - security notes -

Notes

-

+

Reference sheets on cybersecurity tools and techniques.

-
- - -
+

use #tag to filter by tag

@@ -82,18 +68,20 @@ const searchIndex = Object.fromEntries( data-tags={n.data.tags.join(",")} >
-
+
{n.data.title} - + {n.data.description && ( + + {n.data.description} + + )}
{n.data.tags.length > 0 && (
{n.data.tags.map((tag) => ( - + {tag} ))} diff --git a/src/styles/global.css b/src/styles/global.css index fbe20d4..27c351f 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -26,9 +26,9 @@ --color-warning-content: oklch(19.359% 0.042 109.769); --color-error: oklch(62.795% 0.257 29.233); --color-error-content: oklch(12.559% 0.051 29.233); - --radius-selector: 0rem; - --radius-field: 0rem; - --radius-box: 0rem; + --radius-selector: 0.25rem; + --radius-field: 0.25rem; + --radius-box: 0.5rem; --size-selector: 0.25rem; --size-field: 0.25rem; --border: 1px; diff --git a/todolist.txt b/todolist.txt new file mode 100644 index 0000000..a1ce446 --- /dev/null +++ b/todolist.txt @@ -0,0 +1,3 @@ +- Fix left sidebar overflow/minwidth issue +- Transform to svelte 5 components +- The cat just TP