blazed-past-us 0.7.9 → 0.8.0

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.
Binary file
@@ -1,55 +1,70 @@
1
1
  function getPostData(postsMetadata, slug, option) {
2
- return postsMetadata.find((post) => post.slug === slug)?.[option];
2
+ return postsMetadata.find((post) => post.slug === slug)?.[option];
3
3
  }
4
4
  function getPathnameFromLocationHash(locationHash) {
5
- return locationHash.split('/').splice(1).join('/');
5
+ return locationHash.split('/').splice(1).join('/');
6
6
  }
7
7
  function getLocationHashSpecifics(window) {
8
- const hashRoute = window.location.hash;
9
- const pathname = getPathnameFromLocationHash(hashRoute);
10
- const queryString = hashRoute.split('?')[1] || '';
11
- const urlParams = new URLSearchParams(queryString);
12
- return { pathname, queryString, urlParams };
8
+ const hashRoute = window.location.hash;
9
+ const pathname = getPathnameFromLocationHash(hashRoute);
10
+ const queryString = hashRoute.split('?')[1] || '';
11
+ const urlParams = new URLSearchParams(queryString);
12
+ return { pathname, queryString, urlParams };
13
13
  }
14
14
  function getSlug(htmlFilename) {
15
- return htmlFilename.replace('.html', '');
15
+ return htmlFilename.replace('.html', '');
16
16
  }
17
17
  function getTitle(htmlFilename) {
18
- return htmlFilename.replace('.html', '').replaceAll('-', ' ');
18
+ return htmlFilename.replace('.html', '').replaceAll('-', ' ');
19
19
  }
20
20
  function getBrief(fileContent, lines) {
21
- const A = fileContent
22
- .split('\n')
23
- .splice(1)
24
- .filter((str) => !str.includes('tags') && str.length > 10) || '';
25
- let brief = '';
26
- for (let l = 0; l < lines; l++) {
27
- brief += A[l];
28
- }
29
- return brief.replace(/\r/g, ' ');
21
+ const A =
22
+ fileContent
23
+ .split('\n')
24
+ .splice(1)
25
+ .filter((str) => !str.includes('tags') && str.length > 10) || '';
26
+ let brief = '';
27
+ for (let l = 0; l < lines; l++) {
28
+ brief += A[l];
29
+ }
30
+ // Remove unwanted chars.
31
+ const cleanedBrief = brief.replace(/\r/g, ' ').replace(/`/g, '');
32
+ return cleanedBrief;
30
33
  }
31
34
  function getTags(fileContent) {
32
- return (fileContent
33
- .split('\n')
34
- ?.find((str) => str.includes('**tags:**'))
35
- ?.split('**tags:**')
36
- ?.slice(1)[0]
37
- ?.split(',')
38
- .map((str) => str.trim()) || []);
35
+ return (
36
+ fileContent
37
+ .split('\n')
38
+ ?.find((str) => str.includes('**tags:**'))
39
+ ?.split('**tags:**')
40
+ ?.slice(1)[0]
41
+ ?.split(',')
42
+ .map((str) => str.trim()) || []
43
+ );
39
44
  }
40
45
  function getColoredTagsHTML(tags, config) {
41
- return tags
42
- .replace(/\s/g, '')
43
- .toLowerCase()
44
- .split(',')
45
- .map((key) => {
46
- const tagColor = config.tags[key]?.color ?? config.tags.default.color;
47
- return `
48
- <span class="tag" style="--tag-color: ${tagColor}">
49
- ${key}
50
- </span>
46
+ return tags
47
+ .replace(/\s/g, '')
48
+ .toLowerCase()
49
+ .split(',')
50
+ .map((key) => {
51
+ const tagColor = config.tags[key]?.color ?? config.tags.default.color;
52
+ return `
53
+ <span class="tag" style="--tag-color: ${tagColor}">
54
+ ${key}
55
+ </span>
51
56
  `;
52
57
  })
53
- .join(`<span class="tag-separator">, </span>`);
58
+ .join(`<span class="tag-separator">, </span>`);
54
59
  }
55
- export { getPostData, getTitle, getTags, getBrief, getColoredTagsHTML, getSlug, getPathnameFromLocationHash, getLocationHashSpecifics, };
60
+
61
+ export {
62
+ getPostData,
63
+ getTitle,
64
+ getTags,
65
+ getBrief,
66
+ getColoredTagsHTML,
67
+ getSlug,
68
+ getPathnameFromLocationHash,
69
+ getLocationHashSpecifics,
70
+ };
@@ -21,7 +21,6 @@ async function parseMarkdown(_path) {
21
21
  const remarkResult = await remark()
22
22
  .use(remarkParse)
23
23
  .use(remarkInlineSvg)
24
- /* .use(remarkImages) */
25
24
  .use(remarkRehype, { allowDangerousHtml: true })
26
25
  .use(rehypePrettyCode, {
27
26
  theme: JSON.parse(readFileSync(path.join(root, 'src/code-block-theme.json'), 'utf-8')),
@@ -7,6 +7,5 @@ declare function getPostsRegistry(postsDirectoryPath: string): Promise<void | Po
7
7
  declare function copyRecursive(src: string, destination: string): void;
8
8
  declare function log(msg: string, color: MsgColor): void;
9
9
  declare const remarkInlineSvg: Plugin<[], Root, Root>;
10
- declare const remarkImages: Plugin<[], Root, Root>;
11
10
  declare function sortPostsByNewest(postsMetadata: PostMetadata[]): PostMetadata[];
12
- export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, remarkInlineSvg, sortPostsByNewest, remarkImages, };
11
+ export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, remarkInlineSvg, sortPostsByNewest, };
@@ -93,28 +93,7 @@ const remarkInlineSvg = function () {
93
93
  });
94
94
  };
95
95
  };
96
- const remarkImages = function () {
97
- const baseDirectory = process.cwd();
98
- return function transformer(tree) {
99
- visit(tree, 'image', (node, index, parent) => {
100
- if (node.url?.endsWith('.svg'))
101
- return;
102
- if (index === undefined || !parent)
103
- return;
104
- try {
105
- const imagePath = path.resolve(baseDirectory, `./src/assets/images/${node.url}`);
106
- parent.children[index] = {
107
- type: 'html',
108
- value: `<div align="center"><img src="${imagePath}"></div>`,
109
- };
110
- }
111
- catch (error) {
112
- console.warn(error);
113
- }
114
- });
115
- };
116
- };
117
96
  function sortPostsByNewest(postsMetadata) {
118
97
  return postsMetadata.sort((a, b) => b.created.localeCompare(a.created));
119
98
  }
120
- export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, remarkInlineSvg, sortPostsByNewest, remarkImages, };
99
+ export { postNotInRegistry, handlePostsRegistryUpdate, getPostsRegistry, copyRecursive, log, remarkInlineSvg, sortPostsByNewest, };
@@ -17,6 +17,6 @@
17
17
  },
18
18
  "dependencies": {
19
19
  "three": "^0.182.0",
20
- "blazed-past-us": "^0.7.8"
20
+ "blazed-past-us": "^0.7.9"
21
21
  }
22
22
  }
@@ -0,0 +1,69 @@
1
+ documentation
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:
6
+
7
+ ```json
8
+ {
9
+ "base_url": "/blazed-past-us/",
10
+ "subtitle": "let the cosmos bear witness...",
11
+ "tags": {
12
+ "javascript": { "color": "#f5dd42" },
13
+ "typescript": { "color": "#42adf5" },
14
+ "default": { "color": "#e0e0e0" }
15
+ }
16
+ }
17
+ ```
18
+
19
+ This JSON file allows you to configure the `base_url`, the `subtitle` and add your custom `tags` with their respective font color.
20
+
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`
22
+
23
+ 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
+
25
+ ```yml {42} showLineNumbers
26
+ name: deploy to Github pages
27
+
28
+ on:
29
+ push:
30
+ branches:
31
+ - main
32
+
33
+ permissions:
34
+ contents: read
35
+ pages: write
36
+ id-token: write
37
+ deployments: write
38
+
39
+ jobs:
40
+ build-deploy:
41
+ runs-on: ubuntu-latest
42
+ defaults:
43
+ run:
44
+ working-directory: ./src/template
45
+
46
+ steps:
47
+ - uses: actions/checkout@v4
48
+
49
+ - uses: actions/setup-node@v4
50
+ with:
51
+ node-version: 24
52
+
53
+ - run: npm i
54
+ - run: npm run build
55
+
56
+ - uses: actions/upload-pages-artifact@v3
57
+ with:
58
+ path: ./src/template/dist
59
+
60
+ - uses: actions/deploy-pages@v4
61
+
62
+ - name: Create Deployment Record
63
+ uses: chrnorm/deployment-action@v2
64
+ with:
65
+ token: ${{ secrets.GITHUB_TOKEN }}
66
+ environment: github-pages
67
+ environment-url: https://gass-git.github.io/blazed-past-us/
68
+ ref: main
69
+ ```
@@ -1,17 +1,16 @@
1
1
  architecture
2
2
 
3
- I've been enaging with several blogs and communities lately. Reading mostly about things related to software development. And since a few months ago I started to wish for a place in 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 designed, ..) so I started to look around for ways in which I could bring to
4
- life my own blog that would allow me to write posts effortless.
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.
5
4
 
6
- I wanted to build a blog with my own unique flavour. I like feeling the freedom of the early 2000's of the internet. Each site had their own unique style. Surfing the web was exciting and unexpected. The web was full o creativity and authenticity. People used plain languages to build, not frameworks or libraries.
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.
7
6
 
8
- I ended up deciding to go for a static blog hosted in github pages that would build on git push the written content on the IDE. 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 pushing to github.
9
8
 
10
- There were two frameworks that caught my eye: Astro and 11ty.
9
+ There were two frameworks that caught my eye: [Astro](https://astro.build/) and [11ty](https://www.11ty.dev/).
11
10
 
12
- Gravity made me land on 11ty so I decided to check out how to work with it, but I didn't like enough to choose it. These were for a few very picky things:
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:
13
12
 
14
- I wanted to write .md files as clean as when you write them for github. I didn't want to write things like on the top of every post.
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:
15
14
 
16
15
  ```md
17
16
  ---
@@ -20,7 +19,7 @@ other: stuff here
20
19
  ---
21
20
  ```
22
21
 
23
- Or HTML files like:
22
+ Or `html` files like:
24
23
 
25
24
  ```html
26
25
  ---
@@ -30,20 +29,22 @@ layout: layout.html
30
29
  {% for post in collections.post %} {% endfor %}
31
30
  ```
32
31
 
33
- 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).
32
+ 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).
34
33
 
35
- Then I had my commit 0 moment. Why not build my own blog system which would allow to write .md files in a breaze and explore just for fun how fast it can go. I had just read a book about the life of Stan Lee and reading Silver Surfer comic. Since that 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 easthetics.
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.
36
35
 
37
- What started as a blog system it eventually mutated into a framework. Why not ? I've never build a framework before and I'm currently unemployed which means I have time, so why not ?
36
+ ![silver-surfer](./images/silver-surfer.png)
38
37
 
39
- ⚡Blazed past us was born.
38
+ What started as a blog system it eventually mutated into a framework. I've never built a framework before and I'm currently unemployed which means I have time, so why not ?
39
+
40
+ And so, [Blazed Past Us](https://github.com/gass-git/blazed-past-us) was born.
40
41
 
41
42
  Let me show you a bit what is going on under the hood. This is the server side build process architecture:
42
43
 
43
44
  ![server-side-arch](server-side-arch.svg)
44
45
 
45
- And the client side (runtime) architecture. Just one thing though. This is an early implementation. I have few more ideas which change this a bit.
46
+ And the client side (runtime) architecture. Just one thing though. This is an early implementation. I have few more ideas that could change this a bit.
46
47
 
47
48
  ![client-side-runtime](client-side-runtime.svg)
48
49
 
49
- The thing I'm most proud of is about how simple and straightforward it is to write a post. As you can [see here](https://github.com/gass-git/blazed-past-us/blob/main/src/template/src/posts/the-inspiration-and-architecture.md), the post you are now reading looks identical to a regular README.md file.
50
+ The thing I'm most happy about is how simple and straightforward it is to write a post. As you can [see here](https://github.com/gass-git/blazed-past-us/blob/main/src/template/src/posts/the-inspiration-and-architecture.md), the post you are now reading looks identical to a regular `README.md` file.
@@ -0,0 +1,52 @@
1
+ pre {
2
+ overflow-x: auto;
3
+ }
4
+
5
+ figure {
6
+ 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);
11
+ }
12
+
13
+ p code {
14
+ padding: 0.2rem 0.35rem 0.2rem 0.35rem;
15
+ margin: 0 0.2rem 0 0.2rem;
16
+ background: var(--inline-code-bg-color);
17
+ border-radius: 0.4rem;
18
+ }
19
+
20
+ span[data-highlighted-line] {
21
+ background: rgba(200, 200, 255, 0.2);
22
+ }
23
+
24
+ span[data-line] {
25
+ padding: 0.5rem 2rem 0.5rem 1rem;
26
+ }
27
+
28
+ code[data-line-numbers] {
29
+ counter-reset: line;
30
+ }
31
+
32
+ code[data-line-numbers] > [data-line]::before {
33
+ counter-increment: line;
34
+ content: counter(line);
35
+ display: inline-block;
36
+ width: 0.75rem;
37
+ margin-right: 1rem;
38
+ text-align: right;
39
+ color: rgb(92, 92, 92, 0.8);
40
+ }
41
+
42
+ code[data-line-numbers-max-digits="2"] > [data-line]::before {
43
+ width: 1.25rem;
44
+ }
45
+
46
+ code[data-line-numbers-max-digits="3"] > [data-line]::before {
47
+ width: 1.75rem;
48
+ }
49
+
50
+ code[data-line-numbers-max-digits="4"] > [data-line]::before {
51
+ width: 2.25rem;
52
+ }
@@ -1,13 +1,15 @@
1
- @import 'fonts.css';
2
- @import 'animations.css';
3
- @import 'loader.css';
4
- @import 'post.css';
5
- @import 'footer.css';
6
- @import 'header.css';
7
- @import 'home.css';
1
+ @import "fonts.css";
2
+ @import "animations.css";
3
+ @import "loader.css";
4
+ @import "post.css";
5
+ @import "footer.css";
6
+ @import "header.css";
7
+ @import "home.css";
8
+ @import "code.css";
8
9
 
9
10
  :root {
10
11
  --background: #181e3f;
12
+ --inline-code-bg-color: #3b4683;
11
13
  --max-width: 55rem;
12
14
  --neon: #82f9ff;
13
15
  --post-title-color: rgb(241, 241, 241);
@@ -15,7 +17,7 @@
15
17
  --light-blue-09: rgba(129, 213, 255, 0.9);
16
18
  --light-blue-05: rgba(129, 213, 255, 0.5);
17
19
  --light-yellow: #ffffb4;
18
- --body-font-family: 'Merriweather Sans Light';
20
+ --body-font-family: "Merriweather Sans Light";
19
21
  --body-font-size: 1.1rem;
20
22
  --border-radius: 0.5rem;
21
23
  --primary-box-shadow: inset 0 0 0 0.1rem var(--light-blue-05);
@@ -46,6 +48,12 @@ h1 {
46
48
  color: var(--h1-color);
47
49
  }
48
50
 
51
+ img {
52
+ width: auto;
53
+ max-width: 100%;
54
+ border-radius: 1rem;
55
+ }
56
+
49
57
  section {
50
58
  margin: 0 auto 0 auto;
51
59
  }
@@ -84,7 +92,7 @@ svg {
84
92
  }
85
93
 
86
94
  .date {
87
- font-family: 'Inter Regular';
95
+ font-family: "Inter Regular";
88
96
  color: var(--date-color);
89
97
  margin-top: 0.1rem;
90
98
  font-size: 0.85rem;
@@ -14,12 +14,12 @@
14
14
 
15
15
  .post .tag-separator {
16
16
  font-size: 1.4rem;
17
- font-family: 'Permanent Marker Regular';
17
+ font-family: "Permanent Marker Regular";
18
18
  color: var(--body-text-color);
19
19
  }
20
20
 
21
21
  .post .title {
22
- font-family: 'Inter Extra Bold';
22
+ font-family: "Inter Extra Bold";
23
23
  color: var(--post-title-color);
24
24
  font-size: 2.25rem;
25
25
  }
@@ -29,7 +29,7 @@
29
29
  }
30
30
 
31
31
  .post .tag {
32
- font-family: 'Permanent Marker Regular';
32
+ font-family: "Permanent Marker Regular";
33
33
  display: inline-block;
34
34
  margin: 0.5rem 0 2rem 0;
35
35
  font-size: 1.3rem;
@@ -39,46 +39,3 @@
39
39
  line-height: 0.7;
40
40
  opacity: 0.9;
41
41
  }
42
-
43
- pre {
44
- overflow-x: auto;
45
- }
46
-
47
- figure {
48
- margin: 1.5rem 0 2rem 0;
49
- padding: 0.5rem 3rem 0.5rem 0;
50
- font-size: var(--body-font-size);
51
- border-radius: var(--border-radius);
52
- box-shadow: var(--primary-box-shadow);
53
- }
54
-
55
- code {
56
- counter-reset: line;
57
- font-size: var(--body-font-size);
58
- }
59
-
60
- code > [data-line]::before {
61
- counter-increment: line;
62
- content: counter(line);
63
- display: inline-block;
64
- width: 0.75rem;
65
- margin: 0.5rem 1.2rem 0.5rem 1.2rem;
66
- text-align: right;
67
- color: rgb(92, 92, 92, 0.8);
68
- }
69
-
70
- code[data-line-numbers-max-digits='2'] > [data-line]::before {
71
- width: 1.25rem;
72
- }
73
-
74
- code[data-line-numbers-max-digits='3'] > [data-line]::before {
75
- width: 1.75rem;
76
- }
77
-
78
- code[data-line-numbers-max-digits='4'] > [data-line]::before {
79
- width: 2.25rem;
80
- }
81
-
82
- code[data-highlighted-line] {
83
- background: rgba(200, 200, 255, 0.076);
84
- }