blazed-past-us 0.8.2 → 0.8.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -7,8 +7,8 @@ import rehypePrettyCode from 'rehype-pretty-code';
7
7
  import rehypeStringify from 'rehype-stringify';
8
8
  import path from 'node:path';
9
9
  import { getColoredTagsHTML } from '../runtime/getters.js';
10
- import { remarkInlineSvg } from './server-utils.js';
11
10
  import rehypeRaw from 'rehype-raw';
11
+ import { remarkInlineSvg } from 'remark-inline-svg-flex';
12
12
  /**
13
13
  * Converts a Markdown file to HTML with syntax highlighting.
14
14
  *
@@ -20,7 +20,10 @@ async function parseMarkdown(_path) {
20
20
  const markdown = await readFile(_path, { encoding: 'utf8' });
21
21
  const remarkResult = await remark()
22
22
  .use(remarkParse)
23
- .use(remarkInlineSvg)
23
+ .use(remarkInlineSvg, {
24
+ wrapper: '<div align="center"></div>',
25
+ assetsDir: './src/svgs/',
26
+ })
24
27
  .use(remarkRehype, { allowDangerousHtml: true })
25
28
  .use(rehypePrettyCode, {
26
29
  theme: JSON.parse(readFileSync(path.join(root, 'src/code-block-theme.json'), 'utf-8')),
@@ -28,7 +31,7 @@ async function parseMarkdown(_path) {
28
31
  })
29
32
  .use(rehypeRaw)
30
33
  .use(rehypeStringify)
31
- .process(markdown);
34
+ .process({ value: markdown, path: _path });
32
35
  const result = await customizeHTML(root, remarkResult.value);
33
36
  return result;
34
37
  }
@@ -1,11 +1,8 @@
1
1
  import { MsgColor, PostMetadata, PostsPaths, PostsRegistry } from '../types';
2
- import type { Plugin } from 'unified';
3
- import type { Root } from 'mdast';
4
2
  declare function postNotInRegistry(registry: PostsRegistry | [] | void, slug: string): boolean;
5
3
  declare function handlePostsRegistryUpdate(postsRegistry: PostsRegistry | void, paths: PostsPaths): void;
6
4
  declare function getPostsRegistry(postsDirectoryPath: string): Promise<void | PostsRegistry>;
7
5
  declare function copyRecursive(src: string, destination: string): void;
8
6
  declare function log(msg: string, color: MsgColor): void;
9
- declare const remarkInlineSvg: Plugin<[], Root, Root>;
10
7
  declare function sortPostsByNewest(postsMetadata: PostMetadata[]): PostMetadata[];
11
- export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, remarkInlineSvg, sortPostsByNewest, };
8
+ export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, sortPostsByNewest, };
@@ -3,7 +3,6 @@ import fsPromises from 'node:fs/promises';
3
3
  import fs from 'node:fs';
4
4
  import chalk from 'chalk';
5
5
  import pkg from '../../package.json' with { type: 'json' };
6
- import { visit } from 'unist-util-visit';
7
6
  function postNotInRegistry(registry, slug) {
8
7
  return !registry?.some((p) => p.slug === slug);
9
8
  }
@@ -71,29 +70,7 @@ function log(msg, color) {
71
70
  }
72
71
  console.log(`${chalk.blue(pkg.name + ' v' + pkg.version)} ${coloredMsg}`);
73
72
  }
74
- const remarkInlineSvg = function () {
75
- const baseDirectory = process.cwd();
76
- return function transformer(tree) {
77
- visit(tree, 'image', (node, index, parent) => {
78
- if (!node.url?.endsWith('.svg'))
79
- return;
80
- if (index === undefined || !parent)
81
- return;
82
- try {
83
- const svgPath = path.resolve(baseDirectory, `./src/svgs/${node.url}`);
84
- const svgContent = fs.readFileSync(svgPath, 'utf8');
85
- parent.children[index] = {
86
- type: 'html',
87
- value: `<div align="center">${svgContent}</div>`,
88
- };
89
- }
90
- catch (error) {
91
- console.warn(error);
92
- }
93
- });
94
- };
95
- };
96
73
  function sortPostsByNewest(postsMetadata) {
97
74
  return postsMetadata.sort((a, b) => b.created.localeCompare(a.created));
98
75
  }
99
- export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, remarkInlineSvg, sortPostsByNewest, };
76
+ export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, sortPostsByNewest, };
@@ -4,7 +4,7 @@
4
4
  <meta charset="UTF-8" />
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1" />
6
6
  <link href="./src/styles/main.css" rel="stylesheet" />
7
- <link rel="icon" type="image/svg+xml" href="./src/assets/favicon.svg" />
7
+ <link rel="icon" type="image/svg+xml" href="./src/favicon.svg" />
8
8
  </head>
9
9
  <body>
10
10
  <script type="module" src="./src/main.js"></script>
@@ -1,8 +1,6 @@
1
1
  documentation
2
2
 
3
- This is a brief explainer on how to configure the blog, set up the CI action and deploy to Github pages.
4
-
5
- Once you install the scaffolding you will find the file `config.json` in the src directory. It looks like this:
3
+ This is a brief explainer on how to configure the blog, set up the CI action and deploy to Github pages. Once you install the scaffolding you will find the file `config.json` in the src directory. It looks like this:
6
4
 
7
5
  ```json
8
6
  {
@@ -18,7 +16,7 @@ Once you install the scaffolding you will find the file `config.json` in the src
18
16
 
19
17
  This JSON file allows you to configure the `base_url`, the `subtitle` and add your custom `tags` with their respective font color.
20
18
 
21
- The `base_url` is what comes after the origin url. E.g. in the case of this blog you can see that is what comes after `https://gass-git.github.io`
19
+ The `base_url` is what comes after the origin URL, E.g. in the case of this blog you can see that is what comes after `https://gass-git.github.io`
22
20
 
23
21
  In your Github repository create a new workflow with the following code and replace where it says `blazed-past-us` with your `base_url`
24
22
 
@@ -2,20 +2,22 @@ architecture
2
2
 
3
3
  I've been engaging with several blogs and communities lately. Reading mostly about software development. And since a few months ago I started to wish for a place where I could share my own insights and notes. I didn't want to write these on community platforms for a few reasons (I don't own the data, there is no freedom and authenticity in the way these are showcased, ..) so I started to look around for ways in which I could bring to life my own blog that would allow me to write posts effortless. Little did I know, I was about to embark on a several-month journey.
4
4
 
5
- A unique flavour, that was my desire. The creative internet era of the the late 90's and early 2000's. Each site had its own unique style. Surfing the web was exciting and unexpected. People built using plain code, not frameworks or libraries.
5
+ A unique flavour, that was my desire. When it comes to this, I always remind myself about the creative internet era of the late 90's and early 2000's where each site had its own unique style. Surfing the web was exciting and unexpected. People built using plain code, not frameworks or libraries.
6
6
 
7
- I ended up deciding to go for a static blog hosted in Github pages motivated by the free service and the convenience of building the bundle and deploying automatically on git push. In this way the flow for writing a post would be as easy as typing in the IDE and pushing to github.
7
+ I ended up deciding to go for a static blog hosted in Github pages motivated by the free service and the convenience of building the bundle and deploying automatically on git push. In this way the flow for writing a post would be as easy as typing in the IDE and git push.
8
8
 
9
9
  There were two frameworks that caught my eye: [Astro](https://astro.build/) and [11ty](https://www.11ty.dev/).
10
10
 
11
11
  Gravity made me land on [11ty](https://www.11ty.dev/) so I decided to check out how to work with it, but I didn't like it enough. These were for a few very picky things:
12
12
 
13
- I wanted to write Markdown files as clean as when you write them for Github `README.md`. I didn't want to do things such as:
13
+ I wanted to write Markdown files as clean as when you write a `README.md` file. I didn't want to type things such as the following on top of each post file:
14
14
 
15
15
  ```md
16
16
  ---
17
17
  title: hey! this is an article
18
18
  other: stuff here
19
+ probably more stuff here...
20
+ and here...
19
21
  ---
20
22
  ```
21
23
 
@@ -26,12 +28,13 @@ Or `html` files like:
26
28
  layout: layout.html
27
29
  ---
28
30
 
29
- {% for post in collections.post %} {% endfor %}
31
+ {% for post in collections.post %}
32
+ {% endfor %}
30
33
  ```
31
34
 
32
35
  It feels off. An `html` file that looks like that ? It reminds me of Laravel blade syntax (nothing wrong with that though, I kind a liked it).
33
36
 
34
- Then I had my `commit 0` moment. Why not build my own blog system which would allow to write `.md` files in a breeze and explore just for fun how fast it can go. I had just read The Marvelous Life (Stan Lee biography) and a few Silver Surfer comics. Since the super hero has the "surfer" word in its name, it motivated me to create a short dialogue between me and him about a blog. And that gave birth to the whole theme and aesthetics.
37
+ Then I had my `commit 0` moment. Why not build my own blog system which would allow me to write `.md` files in a breeze and explore just for fun how fast it can go. I had just read The Marvelous Life (Stan Lee biography) and a few Silver Surfer comics. Since the super hero has the "surfer" word in its name, it motivated me to create a short dialogue between me and him about a blog. And that gave birth to the whole theme and aesthetics.
35
38
 
36
39
  ![silver-surfer](./images/silver-surfer.png)
37
40
 
@@ -1,28 +1,51 @@
1
+ :root {
2
+ --code-font-size: 1rem;
3
+ --snippet-border: 0.1rem solid rgba(255, 255, 255, 0.2);
4
+ --snippet-border-radius: 0.4rem;
5
+ --snippet-background: rgba(0, 0, 0, 0.4);
6
+ --line-padding: 0.35rem 2rem 0.35rem 1.5rem;
7
+ --highlighted-line-background: rgba(255, 255, 255, 0.1);
8
+ --highlighted-chars-background: rgba(82, 82, 91, 0.502);
9
+ --inline-code-bg-color: rgba(255, 255, 255, 0.1);
10
+ --inline-code-padding: 0rem 0.35rem 0.15rem 0.35rem;
11
+ --inline-code-border: 0.1rem solid rgba(255, 255, 255, 0.15);
12
+ --inline-code-border-radius: 0.1rem;
13
+ }
14
+
1
15
  pre {
2
16
  overflow-x: auto;
3
17
  }
4
18
 
5
19
  figure {
6
20
  margin: 1.5rem 0 2rem 0;
7
- padding: 0.5rem 0rem 0.5rem 0;
8
- font-size: var(--body-font-size);
9
- border-radius: var(--border-radius);
10
- box-shadow: var(--primary-box-shadow);
21
+ padding: 0;
22
+ font-size: var(--code-font-size);
23
+ border-radius: var(--snippet-border-radius);
24
+ border: var(--snippet-border);
25
+ background: var(--snippet-background);
11
26
  }
12
27
 
13
28
  p code {
14
- padding: 0.2rem 0.35rem 0.2rem 0.35rem;
15
- margin: 0 0.2rem 0 0.2rem;
29
+ padding: var(--inline-code-padding);
30
+ margin: 0;
16
31
  background: var(--inline-code-bg-color);
17
- border-radius: 0.4rem;
32
+ border-radius: var(--inline-code-border-radius);
33
+ border: var(--inline-code-border);
18
34
  }
19
35
 
20
36
  span[data-highlighted-line] {
21
- background: rgba(200, 200, 255, 0.2);
37
+ background: var(--highlighted-line-background);
38
+ }
39
+
40
+ mark[data-highlighted-chars] {
41
+ background-color: var(--highlighted-chars-background);
42
+ border-radius: 0.25rem;
43
+ padding: 0.2rem 0.5em 0.3rem 0.5em;
44
+ margin: 0 0.2rem 0 0.2rem;
22
45
  }
23
46
 
24
47
  span[data-line] {
25
- padding: 0.5rem 2rem 0.5rem 1rem;
48
+ padding: var(--line-padding);
26
49
  }
27
50
 
28
51
  code[data-line-numbers] {
@@ -39,14 +62,14 @@ code[data-line-numbers] > [data-line]::before {
39
62
  color: rgb(92, 92, 92, 0.8);
40
63
  }
41
64
 
42
- code[data-line-numbers-max-digits="2"] > [data-line]::before {
65
+ code[data-line-numbers-max-digits='2'] > [data-line]::before {
43
66
  width: 1.25rem;
44
67
  }
45
68
 
46
- code[data-line-numbers-max-digits="3"] > [data-line]::before {
69
+ code[data-line-numbers-max-digits='3'] > [data-line]::before {
47
70
  width: 1.75rem;
48
71
  }
49
72
 
50
- code[data-line-numbers-max-digits="4"] > [data-line]::before {
73
+ code[data-line-numbers-max-digits='4'] > [data-line]::before {
51
74
  width: 2.25rem;
52
75
  }
@@ -5,6 +5,12 @@
5
5
  opacity: 0.9;
6
6
  }
7
7
 
8
+ @media (max-width: 40rem) {
9
+ .post-card {
10
+ padding: 1.6rem 0.5rem 1.6rem 0.5rem;
11
+ }
12
+ }
13
+
8
14
  @media (hover: hover) and (pointer: fine) {
9
15
  .post-card:hover {
10
16
  opacity: 1;
@@ -9,16 +9,17 @@
9
9
 
10
10
  :root {
11
11
  --background: #181e3f;
12
- --inline-code-bg-color: #3b4683;
13
12
  --max-width: 55rem;
14
13
  --neon: #82f9ff;
15
14
  --post-title-color: rgb(241, 241, 241);
16
15
  --body-text-color: #ececec;
17
16
  --light-blue-09: rgba(129, 213, 255, 0.9);
18
17
  --light-blue-05: rgba(129, 213, 255, 0.5);
18
+ --light-blue-02: rgba(129, 213, 255, 0.2);
19
19
  --light-yellow: #ffffb4;
20
+ --yellow: #ffff5c;
20
21
  --body-font-family: "Merriweather Sans Light";
21
- --body-font-size: 1.1rem;
22
+ --body-font-size: 1rem;
22
23
  --border-radius: 0.5rem;
23
24
  --primary-box-shadow: inset 0 0 0 0.1rem var(--light-blue-05);
24
25
  --h1-color: rgb(241, 241, 241);
@@ -30,7 +31,7 @@ a:link,
30
31
  a:visited {
31
32
  text-decoration: none;
32
33
  -webkit-tap-highlight-color: transparent;
33
- color: var(--light-yellow);
34
+ color: var(--yellow);
34
35
  }
35
36
 
36
37
  html,
@@ -3,6 +3,12 @@
3
3
  margin-top: 1.25rem;
4
4
  }
5
5
 
6
+ @media (max-width: 40rem) {
7
+ .post {
8
+ padding: 1.6rem 0.5rem 1.6rem 0.5rem;
9
+ }
10
+ }
11
+
6
12
  .post p {
7
13
  font-family: var(--body-font-family);
8
14
  font-size: var(--body-font-size);
@@ -14,12 +20,12 @@
14
20
 
15
21
  .post .tag-separator {
16
22
  font-size: 1.4rem;
17
- font-family: "Permanent Marker Regular";
23
+ font-family: 'Permanent Marker Regular';
18
24
  color: var(--body-text-color);
19
25
  }
20
26
 
21
27
  .post .title {
22
- font-family: "Inter Extra Bold";
28
+ font-family: 'Inter Extra Bold';
23
29
  color: var(--post-title-color);
24
30
  font-size: 2.25rem;
25
31
  }
@@ -29,7 +35,7 @@
29
35
  }
30
36
 
31
37
  .post .tag {
32
- font-family: "Permanent Marker Regular";
38
+ font-family: 'Permanent Marker Regular';
33
39
  display: inline-block;
34
40
  margin: 0.5rem 0 2rem 0;
35
41
  font-size: 1.3rem;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "blazed-past-us",
3
- "version": "0.8.2",
3
+ "version": "0.8.4",
4
4
  "description": "A static blog framework made for developers that allows content to be written in Markdown directly from the IDE.",
5
5
  "license": "MIT",
6
6
  "author": "gass-git",
@@ -36,6 +36,7 @@
36
36
  "rehype-raw": "^7.0.0",
37
37
  "rehype-stringify": "^10.0.1",
38
38
  "remark": "^15.0.1",
39
+ "remark-inline-svg-flex": "^0.3.4",
39
40
  "remark-parse": "^11.0.0",
40
41
  "remark-rehype": "^11.1.2",
41
42
  "unist-util-visit": "^5.1.0"
File without changes