From 4aa33ad2e29f87a7662f8d3b57f339499abf04fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jozef=20Steinh=C3=BCbl?= Date: Mon, 1 Apr 2024 13:56:11 +0200 Subject: [PATCH] style: prettier --- .prettierrc.cjs | 11 ++ package.json | 4 + pnpm-lock.yaml | 52 ++++++++- src/components/ArrowCard.astro | 46 ++++++-- src/components/BackToPrev.astro | 31 +++-- src/components/BackToTop.astro | 31 +++-- src/components/Footer.astro | 3 +- src/components/Head.astro | 48 ++++---- src/components/Header.astro | 8 +- src/components/Link.astro | 18 +-- src/content/blog/01-getting-started/index.md | 46 ++++---- src/content/blog/02-blog-collection/index.md | 15 ++- .../blog/03-projects-collection/index.md | 3 +- src/content/blog/04-work-collection/index.md | 18 +-- src/content/blog/05-markdown-syntax/index.md | 83 ++++++++------ .../blog/06-mdx-syntax/component.astro | 5 +- src/content/blog/06-mdx-syntax/index.mdx | 7 +- .../blog/07-year-sorting-example/index.md | 2 +- src/content/blog/08-draft-example/index.md | 1 - src/content/config.ts | 2 +- src/content/ctfs/2024/utctf.md | 3 +- src/content/projects/project-1/index.md | 27 +++-- src/content/projects/project-2/index.md | 31 ++--- .../writeups/utctf/2024/misc/survey.md | 2 +- src/lib/writeup.ts | 4 +- src/pages/blog/[...slug].astro | 8 +- src/pages/blog/index.astro | 56 +++++---- .../[year]/[name]/category/[category].astro | 91 +++++++++------ src/pages/ctfs/[year]/[name]/index.astro | 50 ++++---- src/pages/ctfs/index.astro | 59 +++++----- src/pages/index.astro | 107 ++++++++++-------- src/pages/robots.txt.ts | 2 +- src/pages/rss.xml.ts | 17 +-- src/styles/global.css | 2 +- 34 files changed, 521 insertions(+), 372 deletions(-) create mode 100644 .prettierrc.cjs diff --git a/.prettierrc.cjs b/.prettierrc.cjs new file mode 100644 index 0000000..4dc2549 --- /dev/null +++ b/.prettierrc.cjs @@ -0,0 +1,11 @@ +module.exports = { + plugins: [require.resolve("prettier-plugin-astro")], + overrides: [ + { + files: "*.astro", + options: { + parser: "astro", + }, + }, + ], +}; diff --git a/package.json b/package.json index 56cb7df..61b3de5 100644 --- a/package.json +++ b/package.json @@ -32,5 +32,9 @@ "tailwind-merge": "^2.2.2", "tailwindcss": "^3.4.1", "typescript": "^5.4.2" + }, + "devDependencies": { + "prettier": "^3.2.5", + "prettier-plugin-astro": "^0.13.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e0d6d29..4897ae0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -7,7 +7,7 @@ settings: dependencies: '@astrojs/check': specifier: ^0.5.9 - version: 0.5.9(typescript@5.4.2) + version: 0.5.9(prettier-plugin-astro@0.13.0)(prettier@3.2.5)(typescript@5.4.2) '@astrojs/mdx': specifier: ^2.2.0 version: 2.2.0(astro@4.5.6) @@ -63,6 +63,14 @@ dependencies: specifier: ^5.4.2 version: 5.4.2 +devDependencies: + prettier: + specifier: ^3.2.5 + version: 3.2.5 + prettier-plugin-astro: + specifier: ^0.13.0 + version: 0.13.0 + packages: /@aashutoshrathi/word-wrap@1.2.6: @@ -83,13 +91,13 @@ packages: '@jridgewell/trace-mapping': 0.3.25 dev: false - /@astrojs/check@0.5.9(typescript@5.4.2): + /@astrojs/check@0.5.9(prettier-plugin-astro@0.13.0)(prettier@3.2.5)(typescript@5.4.2): resolution: {integrity: sha512-+QsQMtYq4oso+gmilJC9HLmdi0glZ+04V/VyyTTPry7n21jqjX9SfgDpLGxMk5cwPC/vwZMkn6ORGPnkZS/L5w==} hasBin: true peerDependencies: typescript: ^5.0.0 dependencies: - '@astrojs/language-server': 2.8.3(typescript@5.4.2) + '@astrojs/language-server': 2.8.3(prettier-plugin-astro@0.13.0)(prettier@3.2.5)(typescript@5.4.2) chokidar: 3.6.0 fast-glob: 3.3.2 kleur: 4.1.5 @@ -100,6 +108,9 @@ packages: - prettier-plugin-astro dev: false + /@astrojs/compiler@1.8.2: + resolution: {integrity: sha512-o/ObKgtMzl8SlpIdzaxFnt7SATKPxu4oIP/1NL+HDJRzxfJcAkOTAb/ZKMRyULbz4q+1t2/DAebs2Z1QairkZw==} + /@astrojs/compiler@2.7.0: resolution: {integrity: sha512-XpC8MAaWjD1ff6/IfkRq/5k1EFj6zhCNqXRd5J43SVJEBj/Bsmizkm8N0xOYscGcDFQkRgEw6/eKnI5x/1l6aA==} dev: false @@ -108,7 +119,7 @@ packages: resolution: {integrity: sha512-tGmHvrhpzuz0JBHaJX8GywN9g4rldVNHtkoVDC3m/DdzBO70jGoVuc0uuNVglRYnsdwkbG0K02Iw3nOOR3/Y4g==} dev: false - /@astrojs/language-server@2.8.3(typescript@5.4.2): + /@astrojs/language-server@2.8.3(prettier-plugin-astro@0.13.0)(prettier@3.2.5)(typescript@5.4.2): resolution: {integrity: sha512-tO47Lcue7OPXfIDbKVDcshwpC13yaWaTVLyiSOnQ2Yng2Z2SgcJf06Cj4xMpJqGp6s7/o/gcQWYUTl2bpkWKig==} hasBin: true peerDependencies: @@ -128,10 +139,12 @@ packages: '@volar/language-service': 2.1.2 '@volar/typescript': 2.1.2 fast-glob: 3.3.2 + prettier: 3.2.5 + prettier-plugin-astro: 0.13.0 volar-service-css: 0.0.34(@volar/language-service@2.1.2) volar-service-emmet: 0.0.34(@volar/language-service@2.1.2) volar-service-html: 0.0.34(@volar/language-service@2.1.2) - volar-service-prettier: 0.0.34(@volar/language-service@2.1.2) + volar-service-prettier: 0.0.34(@volar/language-service@2.1.2)(prettier@3.2.5) volar-service-typescript: 0.0.34(@volar/language-service@2.1.2) volar-service-typescript-twoslash-queries: 0.0.34(@volar/language-service@2.1.2) vscode-html-languageservice: 5.1.2 @@ -4953,6 +4966,19 @@ packages: engines: {node: '>= 0.8.0'} dev: false + /prettier-plugin-astro@0.13.0: + resolution: {integrity: sha512-5HrJNnPmZqTUNoA97zn4gNQv9BgVhv+et03314WpQ9H9N8m2L9OSV798olwmG2YLXPl1iSstlJCR1zB3x5xG4g==} + engines: {node: ^14.15.0 || >=16.0.0} + dependencies: + '@astrojs/compiler': 1.8.2 + prettier: 3.2.5 + sass-formatter: 0.7.9 + + /prettier@3.2.5: + resolution: {integrity: sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==} + engines: {node: '>=14'} + hasBin: true + /prismjs@1.29.0: resolution: {integrity: sha512-Kx/1w86q/epKcmte75LNrEoT+lX8pBpavuAbvJWRXar7Hz8jrtF+e3vY751p0R8H9HdArwaCTNDDzHg/ScJK1Q==} engines: {node: '>=6'} @@ -5255,6 +5281,9 @@ packages: queue-microtask: 1.2.3 dev: false + /s.color@0.0.15: + resolution: {integrity: sha512-AUNrbEUHeKY8XsYr/DYpl+qk5+aM+DChopnWOPEzn8YKzOhv4l2zH6LzZms3tOZP3wwdOyc0RmTciyi46HLIuA==} + /safe-array-concat@1.1.2: resolution: {integrity: sha512-vj6RsCsWBCf19jIeHEfkRMw8DPiBb+DMXklQ/1SGDHOMlHdPUkZXFQ2YdplS23zESTijAcurb1aSgJA3AgMu1Q==} engines: {node: '>=0.4'} @@ -5279,6 +5308,11 @@ packages: is-regex: 1.1.4 dev: false + /sass-formatter@0.7.9: + resolution: {integrity: sha512-CWZ8XiSim+fJVG0cFLStwDvft1VI7uvXdCNJYXhDvowiv+DsbD1nXLiQ4zrE5UBvj5DWZJ93cwN0NX5PMsr1Pw==} + dependencies: + suf-log: 2.5.3 + /sax@1.3.0: resolution: {integrity: sha512-0s+oAmw9zLl1V1cS9BtZN7JAd0cW5e0QH4W3LWEK6a4LaLEA2OTpGYWDY+6XasBLtz6wkm3u1xRw95mRuJ59WA==} dev: false @@ -5635,6 +5669,11 @@ packages: ts-interface-checker: 0.1.13 dev: false + /suf-log@2.5.3: + resolution: {integrity: sha512-KvC8OPjzdNOe+xQ4XWJV2whQA0aM1kGVczMQ8+dStAO6KfEB140JEVQ9dE76ONZ0/Ylf67ni4tILPJB41U0eow==} + dependencies: + s.color: 0.0.15 + /supports-color@5.5.0: resolution: {integrity: sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==} engines: {node: '>=4'} @@ -6173,7 +6212,7 @@ packages: vscode-uri: 3.0.8 dev: false - /volar-service-prettier@0.0.34(@volar/language-service@2.1.2): + /volar-service-prettier@0.0.34(@volar/language-service@2.1.2)(prettier@3.2.5): resolution: {integrity: sha512-BNfJ8FwfPi1Wm/JkuzNjraOLdtKieGksNT/bDyquygVawv1QUzO2HB1hiMKfZGdcSFG5ZL9R0j7bBfRTfXA2gg==} peerDependencies: '@volar/language-service': ~2.1.0 @@ -6185,6 +6224,7 @@ packages: optional: true dependencies: '@volar/language-service': 2.1.2 + prettier: 3.2.5 vscode-uri: 3.0.8 dev: false diff --git a/src/components/ArrowCard.astro b/src/components/ArrowCard.astro index d2f71ea..8529ca4 100644 --- a/src/components/ArrowCard.astro +++ b/src/components/ArrowCard.astro @@ -1,13 +1,12 @@ --- import { dateRange } from "@lib/utils"; import type { CollectionKey } from "astro:content"; -import type { CollectionEntry } from "astro:content"; interface Entry { data: { title: string; description: string; - } + }; } interface ClickableCollectionEntry extends Entry { @@ -21,20 +20,33 @@ interface DateRangeEntry extends Entry { description: string; dateStart: Date; dateEnd: string | Date | undefined; - } + }; } type Props = { - entry: Entry | ClickableCollectionEntry | DateRangeEntry | (DateRangeEntry & ClickableCollectionEntry); -} + entry: + | Entry + | ClickableCollectionEntry + | DateRangeEntry + | (DateRangeEntry & ClickableCollectionEntry); +}; const { entry } = Astro.props; const href = "collection" in entry ? `/${entry.collection}/${entry.slug}` : "#"; --- - +
- {"dateStart" in entry.data ?
{dateRange(entry.data.dateStart, entry.data.dateEnd)}
: <>} + { + "dateStart" in entry.data ? ( +
+ {dateRange(entry.data.dateStart, entry.data.dateEnd)} +
+ ) : null + }
{entry.data.title}
@@ -42,11 +54,21 @@ const href = "collection" in entry ? `/${entry.collection}/${entry.slug}` : "#"; {entry.data.description}
- - - + class="absolute top-1/2 right-2 -translate-y-1/2 size-5 stroke-2 fill-none stroke-current" + > + +
diff --git a/src/components/BackToPrev.astro b/src/components/BackToPrev.astro index 5cce7d2..2e838cc 100644 --- a/src/components/BackToPrev.astro +++ b/src/components/BackToPrev.astro @@ -1,20 +1,33 @@ --- type Props = { href: string; -} +}; const { href } = Astro.props; --- - - - + - - + class="absolute top-1/2 left-2 -translate-y-1/2 size-4 stroke-2 fill-none stroke-current" + > + +
- +
diff --git a/src/components/BackToTop.astro b/src/components/BackToTop.astro index c11d0c7..0b18acc 100644 --- a/src/components/BackToTop.astro +++ b/src/components/BackToTop.astro @@ -1,12 +1,23 @@ - \ No newline at end of file +
Back to top
+ diff --git a/src/components/Footer.astro b/src/components/Footer.astro index c3a4295..371fbcc 100644 --- a/src/components/Footer.astro +++ b/src/components/Footer.astro @@ -13,7 +13,8 @@ import BackToTop from "@components/BackToTop.astro";
- © 2024 {`|`} {SITE.NAME} + © 2024 {`|`} + {SITE.NAME}
diff --git a/src/components/Link.astro b/src/components/Link.astro index 2014ca2..1426024 100644 --- a/src/components/Link.astro +++ b/src/components/Link.astro @@ -5,15 +5,19 @@ type Props = { href: string; external?: boolean; underline?: boolean; -} +}; const { href, external, underline = true, ...rest } = Astro.props; --- - - + + diff --git a/src/content/blog/01-getting-started/index.md b/src/content/blog/01-getting-started/index.md index af4b7db..bff53ea 100644 --- a/src/content/blog/01-getting-started/index.md +++ b/src/content/blog/01-getting-started/index.md @@ -10,7 +10,7 @@ Edit `src/consts.ts` Customize the base site -```ts +```ts // src/consts.ts export const SITE: Site = { @@ -22,17 +22,17 @@ export const SITE: Site = { }; ``` -| Field | Req | Description | -| :---- | :-- | :-----------| -| NAME | Yes | Displayed in header and footer. Used in SEO and RSS. | -| EMAIL | Yes | Displayed in contact section. | -| NUM_POSTS | Yes | Limit num of posts on home page. | -| NUM_WORKS | Yes | Limit num of works on home page. | -| NUM_PROJECTS | Yes | Limit num of projects on home page. | +| Field | Req | Description | +| :----------- | :-- | :--------------------------------------------------- | +| NAME | Yes | Displayed in header and footer. Used in SEO and RSS. | +| EMAIL | Yes | Displayed in contact section. | +| NUM_POSTS | Yes | Limit num of posts on home page. | +| NUM_WORKS | Yes | Limit num of works on home page. | +| NUM_PROJECTS | Yes | Limit num of projects on home page. | Customize your page metadata -```ts +```ts // src/consts.ts export const HOME: Metadata = { @@ -41,33 +41,33 @@ export const HOME: Metadata = { }; ``` -| Field | Req | Description | -| :---- | :-- | :-----------| -| TITLE | Yes | Displayed in browser tab. Used in SEO and RSS. | -| DESCRIPTION | Yes | Used in SEO and RSS. | +| Field | Req | Description | +| :---------- | :-- | :--------------------------------------------- | +| TITLE | Yes | Displayed in browser tab. Used in SEO and RSS. | +| DESCRIPTION | Yes | Used in SEO and RSS. | Customize your social media -```ts +```ts // src/consts.ts export const SOCIALS: Socials = [ - { + { NAME: "twitter-x", HREF: "https://twitter.com/markhorn_dev", }, - { + { NAME: "github", - HREF: "https://github.com/markhorn-dev" + HREF: "https://github.com/markhorn-dev", }, - { + { NAME: "linkedin", HREF: "https://www.linkedin.com/in/markhorn-dev", - } + }, ]; ``` -| Field | Req | Description | -| :---- | :-- | :-----------| -| NAME | Yes | Displayed in contact section as a link. | -| HREF | Yes | External url to social media profile. | \ No newline at end of file +| Field | Req | Description | +| :---- | :-- | :-------------------------------------- | +| NAME | Yes | Displayed in contact section as a link. | +| HREF | Yes | External url to social media profile. | diff --git a/src/content/blog/02-blog-collection/index.md b/src/content/blog/02-blog-collection/index.md index ec2b05f..1986237 100644 --- a/src/content/blog/02-blog-collection/index.md +++ b/src/content/blog/02-blog-collection/index.md @@ -21,7 +21,6 @@ In the above example, two static pages will be generated, based on the existence - `https://example.com/blog/post-1` - `https://example.com/blog/post-2` - All content must be preceded by required metadata in the markdown file in `yaml` format, and be enclosed by triple dashes. --- --- ```mdx @@ -35,12 +34,12 @@ draft: false Metadata fields -| Field | Req | Type | Remarks | -| :---------- | :-- | :------ | :----------------------------------------------- | -| title | Yes | string | Title of the content. Used in SEO and RSS. | -| description | Yes | string | Description of the content. Used in SEO and RSS. | -| date | Yes | string | Must be a valid date string (able to be parsed). | -| draft | No* | boolean | draft: true, content will not be published. | +| Field | Req | Type | Remarks | +| :---------- | :--- | :------ | :----------------------------------------------- | +| title | Yes | string | Title of the content. Used in SEO and RSS. | +| description | Yes | string | Description of the content. Used in SEO and RSS. | +| date | Yes | string | Must be a valid date string (able to be parsed). | +| draft | No\* | boolean | draft: true, content will not be published. | All that's left to do is write your content under the metadata. @@ -57,4 +56,4 @@ draft: false This is a paragraph. ``` -🎉 Congrats, you are now a blogger. \ No newline at end of file +🎉 Congrats, you are now a blogger. diff --git a/src/content/blog/03-projects-collection/index.md b/src/content/blog/03-projects-collection/index.md index b3b2926..821488d 100644 --- a/src/content/blog/03-projects-collection/index.md +++ b/src/content/blog/03-projects-collection/index.md @@ -21,7 +21,6 @@ In the above example, two static pages will be generated, based on the existence - `https://example.com/projects/project-1` - `https://example.com/projects/project-2` - All content must be preceded by required metadata in the markdown file in `yaml` format, and be enclosed by triple dashes. --- --- ```mdx @@ -59,4 +58,4 @@ draft: false This is a paragraph about my project. ``` -🎉 Congrats, you are now a blogger, _and_ developer. \ No newline at end of file +🎉 Congrats, you are now a blogger, _and_ developer. diff --git a/src/content/blog/04-work-collection/index.md b/src/content/blog/04-work-collection/index.md index 7f585be..8f9f1a8 100644 --- a/src/content/blog/04-work-collection/index.md +++ b/src/content/blog/04-work-collection/index.md @@ -33,14 +33,14 @@ dateEnd: "11/27/2022" Metadata fields -| Field | Req | Type | Remarks | -| :---------- | :-- | :------ | :----------------------------------------------- | -| company | Yes | string | Company name. | -| role | Yes | string | Role at the company. Ex: Full stack developer. | -| dateStart | Yes | string | Date string that can be parsed to a date. | -| dateEnd | Yes | string | Date string that can be parsed to a date. | - -\* _Note: If you are still employed at company, for dateEnd you can enter Current, +| Field | Req | Type | Remarks | +| :-------- | :-- | :----- | :--------------------------------------------- | +| company | Yes | string | Company name. | +| role | Yes | string | Role at the company. Ex: Full stack developer. | +| dateStart | Yes | string | Date string that can be parsed to a date. | +| dateEnd | Yes | string | Date string that can be parsed to a date. | + +\* _Note: If you are still employed at company, for dateEnd you can enter Current, Now or Present instead of a date._ All that's left to do is write your content under the metadata. @@ -58,4 +58,4 @@ draft: false This is a paragraph about my role at this company. ``` -🎉 Congrats, you are now a blogger, _and_ developer, _and_ employed. \ No newline at end of file +🎉 Congrats, you are now a blogger, _and_ developer, _and_ employed. diff --git a/src/content/blog/05-markdown-syntax/index.md b/src/content/blog/05-markdown-syntax/index.md index cd9cc58..8c60f49 100644 --- a/src/content/blog/05-markdown-syntax/index.md +++ b/src/content/blog/05-markdown-syntax/index.md @@ -12,10 +12,15 @@ To create headings, use hash symbols (#) followed by a space. The number of hash ```md # Heading 1 + ## Heading 2 + ### Heading 3 + #### Heading 4 + ##### Heading 5 + ###### Heading 6 ``` @@ -34,9 +39,13 @@ Simply type non-indented text, surrounded by empty lines. ```md + I really like using Markdown. + + I think I'll use it to format all of my content from now on. + ``` @@ -51,11 +60,12 @@ I think I'll use it to format all of my content from now on. Use double `*` or `_` to denote bold text. ```md -it was the **best** of times, -it was the __worst__ of times +it was the **best** of times, +it was the **worst** of times ``` + It was the **best** of times,
-it was the __worst__ of times +it was the **worst** of times --- @@ -64,11 +74,12 @@ it was the __worst__ of times Use single `*` to denote italic text. ```md -it was the age of *wisdom*, -it was the age of *foolishness* +it was the age of _wisdom_, +it was the age of _foolishness_ ``` -it was the age of *wisdom*,
-it was the age of *foolishness* + +it was the age of _wisdom_,
+it was the age of _foolishness_ --- @@ -77,11 +88,12 @@ it was the age of *foolishness* Use `*`, `**` and `_` to combine effects. ```md -it was the season of ***light***, -it was the season of *__darkness__* +it was the season of **_light_**, +it was the season of _**darkness**_ ``` -it was the season of ***light***,
-it was the season of *__darkness__* + +it was the season of **_light_**,
+it was the season of _**darkness**_ --- @@ -90,8 +102,8 @@ it was the season of *__darkness__* Use triple `---` to denote a line break. ```md - ---- +## + ``` @@ -140,15 +152,15 @@ Add a number followed by a period for items. For sub items, indent. ```md 1. Item 1 2. Item 2 - 1. Sub item 1 - 2. Sub item 2 + 1. Sub item 1 + 2. Sub item 2 3. Item 3 ``` 1. Item 1 2. Item 2 - 1. Sub item 1 - 2. Sub item 2 + 1. Sub item 1 + 2. Sub item 2 3. Item 3 --- @@ -160,15 +172,15 @@ Add a `-` or `+` for items. Don't mix. For sub items, indent. ```md - Item 1 - Item 2 - - Sub item 1 - - Sub item 2 + - Sub item 1 + - Sub item 2 - Item 3 ``` - Item 1 - Item 2 - - Sub item 1 - - Sub item 2 + - Sub item 1 + - Sub item 2 - Item 3 --- @@ -319,18 +331,18 @@ Combine a list with 2 square brackets. `spc` incomplete `x` complete. Use `-` for header, `|` for columns, `:` for alignment. ```md -| Item | Ct | -| :------ | --: | -| Bread | 1 | -| Milk | 1 | -| Haribo | 10 | +| Item | Ct | +| :----- | --: | +| Bread | 1 | +| Milk | 1 | +| Haribo | 10 | ``` -| Item | Buy | -| :------ | --: | -| Bread | 1 | -| Milk | 1 | -| Haribo | 10 | +| Item | Buy | +| :----- | --: | +| Bread | 1 | +| Milk | 1 | +| Haribo | 10 | --- @@ -377,9 +389,9 @@ Denote a code block by enclosing a section of valid code in triple backticks. Sy ```` ```js - function hello() { - console.log("hello world"); - } +function hello() { + console.log("hello world"); +} ``` --- @@ -392,6 +404,3 @@ https://www.markdownguide.org/basic-syntax https://www.markdownguide.org/extended-syntax/ --- - - - diff --git a/src/content/blog/06-mdx-syntax/component.astro b/src/content/blog/06-mdx-syntax/component.astro index 282a2f3..8df2106 100644 --- a/src/content/blog/06-mdx-syntax/component.astro +++ b/src/content/blog/06-mdx-syntax/component.astro @@ -4,6 +4,7 @@ \ No newline at end of file + diff --git a/src/content/blog/06-mdx-syntax/index.mdx b/src/content/blog/06-mdx-syntax/index.mdx index ea2503b..030ed5d 100644 --- a/src/content/blog/06-mdx-syntax/index.mdx +++ b/src/content/blog/06-mdx-syntax/index.mdx @@ -15,7 +15,7 @@ This guide will cover the basics of mdx syntax and how to use it, as well as a f ### Example 1 -Importing a component from the `/components` directory. +Importing a component from the `/components` directory. This component will accept a javascript date object and format it as a string. @@ -51,9 +51,9 @@ import RelativeComponent from "./component.astro"; Nano is an extremely lightweight theme, with no frameworks, so there aren't any examples of react, vue, solid etc. You can integrate these frameworks using -the guide below, and also use those components in your mdx files. +the guide below, and also use those components in your mdx files. -Don't forget to +Don't forget to use the `client` directive to make them interactive. ```astro @@ -63,6 +63,7 @@ use the `client` directive to make them interactive. --- ### More Links + - [MDX Syntax Documentation](https://mdxjs.com/docs/what-is-mdx) - [Astro Framework Integrations](https://docs.astro.build/en/guides/integrations-guide) - [Astro Usage Documentation](https://docs.astro.build/en/guides/markdown-content/#markdown-and-mdx-pages) diff --git a/src/content/blog/07-year-sorting-example/index.md b/src/content/blog/07-year-sorting-example/index.md index 5447825..c8cb1ff 100644 --- a/src/content/blog/07-year-sorting-example/index.md +++ b/src/content/blog/07-year-sorting-example/index.md @@ -4,4 +4,4 @@ description: "Nano groups posts by year." date: "12/31/2023" --- -This post is to demonstrate the year sorting capabilities. \ No newline at end of file +This post is to demonstrate the year sorting capabilities. diff --git a/src/content/blog/08-draft-example/index.md b/src/content/blog/08-draft-example/index.md index ac6d99a..38b5167 100644 --- a/src/content/blog/08-draft-example/index.md +++ b/src/content/blog/08-draft-example/index.md @@ -8,4 +8,3 @@ draft: false This post is to demonstrate the year sorting capabilities. If you are seeing this post, edit `src/content/08-draft-example` and enter `draft: true` in the metadata. - diff --git a/src/content/config.ts b/src/content/config.ts index abe69fa..61cca20 100644 --- a/src/content/config.ts +++ b/src/content/config.ts @@ -31,7 +31,7 @@ const ctfs = defineCollection({ z.object({ name: z.string(), description: z.string(), - }) + }), ), }), }); diff --git a/src/content/ctfs/2024/utctf.md b/src/content/ctfs/2024/utctf.md index baa7ebb..fffbc07 100644 --- a/src/content/ctfs/2024/utctf.md +++ b/src/content/ctfs/2024/utctf.md @@ -23,7 +23,8 @@ Open to all! Problems will span difficulties ranging from beginner-friendly to c Run by Information & Systems Security Society team at The University of Texas at Austin. More information: + - List of sponsors: https://www.isss.io/ - ISSS (organization): https://www.isss.io/ -[CTFtime](https://ctftime.org/event/2302/) \ No newline at end of file +[CTFtime](https://ctftime.org/event/2302/) diff --git a/src/content/projects/project-1/index.md b/src/content/projects/project-1/index.md index a71f39d..d7907f7 100644 --- a/src/content/projects/project-1/index.md +++ b/src/content/projects/project-1/index.md @@ -41,12 +41,15 @@ It is primarily Astro, Tailwind and Typescript, with a very small amount of Soli - ✅ Searchable content (posts and projects) ## 💯 Lighthouse score + ![Astro Sphere Lighthouse Score](/lighthouse.png) ## 🕊️ Lightweight + All pages under 100kb (including fonts) ## ⚡︎ Fast + Rendered in ~40ms on localhost ## 📄 Configuration @@ -59,18 +62,18 @@ All commands are run from the root of the project, from a terminal: Replace npm with your package manager of choice. `npm`, `pnpm`, `yarn`, `bun`, etc -| Command | Action | -| :------------------------ | :----------------------------------------------- | -| `npm install` | Installs dependencies | -| `npm run dev` | Starts local dev server at `localhost:4321` | -| `npm run sync` | Generates TypeScript types for all Astro modules.| -| `npm run build` | Build your production site to `./dist/` | -| `npm run preview` | Preview your build locally, before deploying | -| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | -| `npm run astro -- --help` | Get help using the Astro CLI | -| `npm run lint` | Run ESLint | -| `npm run lint:fix` | Auto-fix ESLint issues | +| Command | Action | +| :------------------------ | :------------------------------------------------ | +| `npm install` | Installs dependencies | +| `npm run dev` | Starts local dev server at `localhost:4321` | +| `npm run sync` | Generates TypeScript types for all Astro modules. | +| `npm run build` | Build your production site to `./dist/` | +| `npm run preview` | Preview your build locally, before deploying | +| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | +| `npm run astro -- --help` | Get help using the Astro CLI | +| `npm run lint` | Run ESLint | +| `npm run lint:fix` | Auto-fix ESLint issues | ## 🏛️ License -MIT \ No newline at end of file +MIT diff --git a/src/content/projects/project-2/index.md b/src/content/projects/project-2/index.md index 04e6df4..e945198 100644 --- a/src/content/projects/project-2/index.md +++ b/src/content/projects/project-2/index.md @@ -42,12 +42,15 @@ It was designed as an even more minimal theme than my popular theme [Astro Spher - ✅ MDX Support (components in your markdown) ## 💯 Lighthouse score + ![Astro Nano Lighthouse Score](/lighthouse.png) ## 🕊️ Lightweight + No frameworks or added bulk ## ⚡︎ Fast + Rendered in ~40ms on localhost ## 📄 Configuration @@ -60,20 +63,20 @@ All commands are run from the root of the project, from a terminal: Replace npm with your package manager of choice. `npm`, `pnpm`, `yarn`, `bun`, etc -| Command | Action | -| :------------------------ | :----------------------------------------------- | -| `npm install` | Installs dependencies | -| `npm run dev` | Starts local dev server at `localhost:4321` | -| `npm run dev:network` | Starts local dev server on local network | -| `npm run sync` | Generates TypeScript types for all Astro modules.| -| `npm run build` | Build your production site to `./dist/` | -| `npm run preview` | Preview your build locally, before deploying | -| `npm run preview:network` | Preview build on local network | -| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | -| `npm run astro -- --help` | Get help using the Astro CLI | -| `npm run lint` | Run ESLint | -| `npm run lint:fix` | Auto-fix ESLint issues | +| Command | Action | +| :------------------------ | :------------------------------------------------ | +| `npm install` | Installs dependencies | +| `npm run dev` | Starts local dev server at `localhost:4321` | +| `npm run dev:network` | Starts local dev server on local network | +| `npm run sync` | Generates TypeScript types for all Astro modules. | +| `npm run build` | Build your production site to `./dist/` | +| `npm run preview` | Preview your build locally, before deploying | +| `npm run preview:network` | Preview build on local network | +| `npm run astro ...` | Run CLI commands like `astro add`, `astro check` | +| `npm run astro -- --help` | Get help using the Astro CLI | +| `npm run lint` | Run ESLint | +| `npm run lint:fix` | Auto-fix ESLint issues | ## 🏛️ License -MIT \ No newline at end of file +MIT diff --git a/src/content/writeups/utctf/2024/misc/survey.md b/src/content/writeups/utctf/2024/misc/survey.md index 75244bd..60aa71d 100644 --- a/src/content/writeups/utctf/2024/misc/survey.md +++ b/src/content/writeups/utctf/2024/misc/survey.md @@ -5,4 +5,4 @@ points: 100 solves: 272 --- -yeh' survey \ No newline at end of file +yeh' survey diff --git a/src/lib/writeup.ts b/src/lib/writeup.ts index fcbb681..15bf12d 100644 --- a/src/lib/writeup.ts +++ b/src/lib/writeup.ts @@ -6,14 +6,14 @@ type WriteUp = CollectionEntry<"writeups"> & { }; export async function parseWriteUp( - entry: CollectionEntry<"writeups"> + entry: CollectionEntry<"writeups">, ): Promise { const [ctfName, year, category] = entry.slug.split("/"); const ctf = (await getCollection("ctfs")).find( (ctf) => ctf.data.title.toLowerCase() === ctfName && - ctf.data.dateStart.getFullYear() === Number(year) + ctf.data.dateStart.getFullYear() === Number(year), ); if (!ctf) { diff --git a/src/pages/blog/[...slug].astro b/src/pages/blog/[...slug].astro index cbddad1..0f3dcd8 100644 --- a/src/pages/blog/[...slug].astro +++ b/src/pages/blog/[...slug].astro @@ -8,7 +8,7 @@ import BackToPrev from "@components/BackToPrev.astro"; export async function getStaticPaths() { const posts = (await getCollection("blog")) - .filter(post => !post.data.draft) + .filter((post) => !post.data.draft) .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()); return posts.map((post) => ({ params: { slug: post.slug }, @@ -24,9 +24,7 @@ const { Content } = await post.render();
- - Back to blog - + Back to blog
@@ -46,4 +44,4 @@ const { Content } = await post.render(); - \ No newline at end of file + diff --git a/src/pages/blog/index.astro b/src/pages/blog/index.astro index 72c802e..9f45a27 100644 --- a/src/pages/blog/index.astro +++ b/src/pages/blog/index.astro @@ -6,50 +6,46 @@ import ArrowCard from "@components/ArrowCard.astro"; import { BLOG } from "@consts"; const data = (await getCollection("blog")) - .filter(post => !post.data.draft) + .filter((post) => !post.data.draft) .sort((a, b) => b.data.date.valueOf() - a.data.date.valueOf()); - + type Acc = { [year: string]: CollectionEntry<"blog">[]; -} +}; const posts = data.reduce((acc: Acc, post) => { - const year = post.data.date.getFullYear().toString(); - if (!acc[year]) { - acc[year] = []; - } - acc[year].push(post); - return acc; - }, {}); + const year = post.data.date.getFullYear().toString(); + if (!acc[year]) { + acc[year] = []; + } + acc[year].push(post); + return acc; +}, {}); -const years = Object.keys(posts).sort((a, b) => parseInt(b) - parseInt(a)); +const years = Object.keys(posts).sort((a, b) => parseInt(b) - parseInt(a)); ---
-
- Blog -
+
Blog
- {years.map(year => ( -
-
- {year} -
-
-
    - { - posts[year].map((post) => ( + { + years.map((year) => ( +
    +
    {year}
    +
    +
      + {posts[year].map((post) => (
    • - +
    • - )) - } -
    -
    -
    - ))} + ))} +
+
+
+ )) + }
diff --git a/src/pages/ctfs/[year]/[name]/category/[category].astro b/src/pages/ctfs/[year]/[name]/category/[category].astro index c4dcac1..e9ae377 100644 --- a/src/pages/ctfs/[year]/[name]/category/[category].astro +++ b/src/pages/ctfs/[year]/[name]/category/[category].astro @@ -9,15 +9,20 @@ import ArrowCard from "@components/ArrowCard.astro"; import { parseWriteUp } from "@lib/writeup"; export async function getStaticPaths() { - const ctfs = (await getCollection("ctfs")) - .sort((a, b) => b.data.dateStart.valueOf() - a.data.dateStart.valueOf()); + const ctfs = (await getCollection("ctfs")).sort( + (a, b) => b.data.dateStart.valueOf() - a.data.dateStart.valueOf(), + ); const paths = []; for (const ctf of ctfs) { for (const category of ctf.data.categories) { paths.push({ - params: { year: ctf.data.dateStart.getFullYear(), name: ctf.data.title.toLowerCase(), category: category.name }, + params: { + year: ctf.data.dateStart.getFullYear(), + name: ctf.data.title.toLowerCase(), + category: category.name, + }, props: { ctf, category }, }); } @@ -26,16 +31,23 @@ export async function getStaticPaths() { return paths; } type Props = { - ctf: CollectionEntry<"ctfs">, - category: CollectionEntry<"ctfs">["data"]["categories"][0], + ctf: CollectionEntry<"ctfs">; + category: CollectionEntry<"ctfs">["data"]["categories"][0]; }; const { ctf, category } = Astro.props; const { Content } = await ctf.render(); -const writeups = (await Promise.all((await getCollection("writeups")) - .map(writeup => parseWriteUp(writeup)))) - .filter(writeup => writeup.ctf.data.title === ctf.data.title && writeup.category === category.name) +const writeups = ( + await Promise.all( + (await getCollection("writeups")).map((writeup) => parseWriteUp(writeup)), + ) +) + .filter( + (writeup) => + writeup.ctf.data.title === ctf.data.title && + writeup.category === category.name, + ) .sort((a, b) => b.data.points - a.data.points); --- @@ -60,37 +72,42 @@ const writeups = (await Promise.all((await getCollection("writeups")) {ctf.data.title} - {capitalize(category.name)}
- +
- {writeups.length > 0 ?
-
-
- Writeups -
-
-
    - {writeups.map(writeup => ( -
  • - -
  • - ))} -
-
- :
-
-
- No writeups written -
-
-
} + { + writeups.length > 0 ? ( +
+
+
Writeups
+
+
    + {writeups.map((writeup) => ( +
  • + +
  • + ))} +
+
+ ) : ( +
+
+
+ No writeups written +
+
+
+ ) + }
-
\ No newline at end of file + diff --git a/src/pages/ctfs/[year]/[name]/index.astro b/src/pages/ctfs/[year]/[name]/index.astro index 28bc605..9155dd6 100644 --- a/src/pages/ctfs/[year]/[name]/index.astro +++ b/src/pages/ctfs/[year]/[name]/index.astro @@ -8,10 +8,14 @@ import BackToPrev from "@components/BackToPrev.astro"; import ArrowCard from "@components/ArrowCard.astro"; export async function getStaticPaths() { - const ctfs = (await getCollection("ctfs")) - .sort((a, b) => b.data.dateStart.valueOf() - a.data.dateStart.valueOf()); + const ctfs = (await getCollection("ctfs")).sort( + (a, b) => b.data.dateStart.valueOf() - a.data.dateStart.valueOf(), + ); return ctfs.map((ctf) => ({ - params: { year: ctf.data.dateStart.getFullYear(), name: ctf.data.title.toLowerCase() }, + params: { + year: ctf.data.dateStart.getFullYear(), + name: ctf.data.title.toLowerCase(), + }, props: ctf, })); } @@ -24,9 +28,7 @@ const { Content } = await ctf.render();
- - Back to CTFs - + Back to CTFs
@@ -42,31 +44,33 @@ const { Content } = await ctf.render(); {ctf.data.title}
- +
-
- Categories -
+
Categories
    - {ctf.data.categories.map(category => ( -
  • - -
  • - ))} + { + ctf.data.categories.map((category) => ( +
  • + +
  • + )) + }
-
\ No newline at end of file + diff --git a/src/pages/ctfs/index.astro b/src/pages/ctfs/index.astro index 309f8e7..f66b853 100644 --- a/src/pages/ctfs/index.astro +++ b/src/pages/ctfs/index.astro @@ -5,50 +5,47 @@ import Container from "@components/Container.astro"; import ArrowCard from "@components/ArrowCard.astro"; import { CTFS } from "@consts"; -const data = (await getCollection("ctfs")) - .sort((a, b) => b.data.dateStart.valueOf() - a.data.dateStart.valueOf()); - +const data = (await getCollection("ctfs")).sort( + (a, b) => b.data.dateStart.valueOf() - a.data.dateStart.valueOf(), +); + type Acc = { [year: string]: CollectionEntry<"ctfs">[]; -} +}; const ctfs = data.reduce((acc: Acc, ctf) => { - const year = ctf.data.dateStart.getFullYear().toString(); - if (!acc[year]) { - acc[year] = []; - } - acc[year].push(ctf); - return acc; - }, {}); + const year = ctf.data.dateStart.getFullYear().toString(); + if (!acc[year]) { + acc[year] = []; + } + acc[year].push(ctf); + return acc; +}, {}); -const years = Object.keys(ctfs).sort((a, b) => parseInt(b) - parseInt(a)); +const years = Object.keys(ctfs).sort((a, b) => parseInt(b) - parseInt(a)); ---
-
- CTFs -
+
CTFs
- {years.map(year => ( -
-
- {year} -
-
-
    - { - ctfs[year].map((ctf) => ( + { + years.map((year) => ( +
    +
    {year}
    +
    +
      + {ctfs[year].map((ctf) => (
    • - +
    • - )) - } -
    -
    -
    - ))} + ))} +
+
+
+ )) + }
diff --git a/src/pages/index.astro b/src/pages/index.astro index 26fe3eb..3f0c027 100644 --- a/src/pages/index.astro +++ b/src/pages/index.astro @@ -7,51 +7,53 @@ import Link from "@components/Link.astro"; import { SITE, HOME, SOCIALS } from "@consts"; import { parseWriteUp } from "@lib/writeup"; -const writeups = (await Promise.all((await getCollection("writeups")) - .map(writeup => parseWriteUp(writeup)))) - .sort((a, b) => b.ctf.data.dateStart.valueOf() - a.ctf.data.dateStart.valueOf()) +const writeups = ( + await Promise.all( + (await getCollection("writeups")).map((writeup) => parseWriteUp(writeup)), + ) +) + .sort( + (a, b) => b.ctf.data.dateStart.valueOf() - a.ctf.data.dateStart.valueOf(), + ) .sort((a, b) => b.data.points - a.data.points) - .slice(0,SITE.NUM_WRITEUPS_ON_HOMEPAGE); + .slice(0, SITE.NUM_WRITEUPS_ON_HOMEPAGE); const ctfs = (await getCollection("ctfs")) .sort((a, b) => b.data.dateStart.valueOf() - a.data.dateStart.valueOf()) - .slice(0,SITE.NUM_CTFS_ON_HOMEPAGE); - + .slice(0, SITE.NUM_CTFS_ON_HOMEPAGE); ---

- Hi 👋 + Hi 👋

We're a group of CTF enthusiasts from Slovakia and Czechia who enjoy - the challenge of solving security problems. We're always looking for new - ways to improve our skills and knowledge. Here, you can find our write- - ups and solutions to some of the CTFs and their challenges! Passion and - joy drive us, not profit. + the challenge of solving security problems. We're always looking for + new ways to improve our skills and knowledge. Here, you can find our + write- ups and solutions to some of the CTFs and their challenges! + Passion and joy drive us, not profit.

-
- Latest CTFs -
- - See all ctfs - +
Latest CTFs
+ See all ctfs
    - {ctfs.map(ctf => ( -
  • - -
  • - ))} + { + ctfs.map((ctf) => ( +
  • + +
  • + )) + }
@@ -60,44 +62,51 @@ const ctfs = (await getCollection("ctfs"))
Latest writeups
- - See all writeups - + See all writeups
    - {writeups.map(writeup => ( -
  • - -
  • - ))} + { + writeups.map((writeup) => ( +
  • + +
  • + )) + }
-
- Links -
+
Links

- If you're only interested in the challenge codes, check out our GitHub. - And if you're curious about our points, take a look at CTFtime. + If you're only interested in the challenge codes, check out our + GitHub. And if you're curious about our points, take a look at + CTFtime.

    - {SOCIALS.map(SOCIAL => ( -
  • - - {SOCIAL.NAME} - - {SOCIAL.NAME == SOCIALS.at(-1)?.NAME ? "" : "/"} -
  • - ))} + { + SOCIALS.map((SOCIAL) => ( +
  • + + {SOCIAL.NAME} + + {SOCIAL.NAME == SOCIALS.at(-1)?.NAME ? "" : "/"} +
  • + )) + }
diff --git a/src/pages/robots.txt.ts b/src/pages/robots.txt.ts index e339795..bfb5261 100644 --- a/src/pages/robots.txt.ts +++ b/src/pages/robots.txt.ts @@ -13,4 +13,4 @@ export const GET: APIRoute = () => { "Content-Type": "text/plain; charset=utf-8", }, }); -}; \ No newline at end of file +}; diff --git a/src/pages/rss.xml.ts b/src/pages/rss.xml.ts index 335695c..35a1318 100644 --- a/src/pages/rss.xml.ts +++ b/src/pages/rss.xml.ts @@ -3,18 +3,19 @@ import { getCollection } from "astro:content"; import { HOME } from "@consts"; type Context = { - site: string -} + site: string; +}; export async function GET(context: Context) { - const blog = (await getCollection("blog")) - .filter(post => !post.data.draft); + const blog = (await getCollection("blog")).filter((post) => !post.data.draft); - const projects = (await getCollection("projects")) - .filter(project => !project.data.draft); + const projects = (await getCollection("projects")).filter( + (project) => !project.data.draft, + ); - const items = [...blog, ...projects] - .sort((a, b) => new Date(b.data.date).valueOf() - new Date(a.data.date).valueOf()); + const items = [...blog, ...projects].sort( + (a, b) => new Date(b.data.date).valueOf() - new Date(a.data.date).valueOf(), + ); return rss({ title: HOME.TITLE, diff --git a/src/styles/global.css b/src/styles/global.css index 5bc9de3..fd16e38 100644 --- a/src/styles/global.css +++ b/src/styles/global.css @@ -70,4 +70,4 @@ html #back-to-top { html.scrolled #back-to-top { @apply opacity-100 pointer-events-auto; -} \ No newline at end of file +}