Skip to content

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
niltor committed Jul 31, 2024
2 parents b93b695 + 0fd7d1c commit 143fb4e
Show file tree
Hide file tree
Showing 9 changed files with 163 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ jobs:
with:
dotnet-version: '8.x'

- run: dotnet tool install -g Ater.EasyBlog --version 1.0.0-beta1
- run: ezblog build ./Content ./WebApp
- run: dotnet tool install -g Ater.EasyBlog --version 1.0.0
- run: ezblog build ./Content ./site

- name: Upload artifact
uses: actions/upload-pages-artifact@v3

with:
path: 'WebApp/'
path: 'site/'

- name: Deploy to GitHub Pages
id: deployment
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ jobs:
with:
dotnet-version: 8.x

- run: dotnet tool install -g Ater.EasyBlog --version 1.0.0-beta1
- run: dotnet tool install -g Ater.EasyBlog --version 1.0.0
- run: ezblog build ./Content ./_site

- name: Upload artifact
Expand Down
2 changes: 1 addition & 1 deletion README_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ jobs:
with:
dotnet-version: 8.x

- run: dotnet tool install -g Ater.EasyBlog --version 1.0.0-beta1
- run: dotnet tool install -g Ater.EasyBlog --version 1.0.0
- run: ezblog build ./Content ./_site

- name: Upload artifact
Expand Down
2 changes: 1 addition & 1 deletion src/BuildSite/BuildSite.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageOutputPath>./nupkg</PackageOutputPath>
<AssemblyVersion>8.0.0</AssemblyVersion>
<PackageId>Ater.EasyBlog</PackageId>
<Version>1.0.0-beta1</Version>
<Version>1.0.0</Version>
<Description>The Static Blog Site Generator!</Description>
<Authors>NilTor</Authors>
<Company>Atersoft</Company>
Expand Down
6 changes: 6 additions & 0 deletions src/NodePackage/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/bin/*.d.ts
/bin/*.pdb
/bin/*.xml
/obj
*.csproj
*.sln
64 changes: 64 additions & 0 deletions src/NodePackage/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Blog

This tool generates a `pure static` blog website from a `markdown` document through commands. With the help of `GitHub Pages`, you can have a personal blog for free in 5 minutes.It has the following characteristics

- Provide command line tools to generate static websites
- Generate a pure static website with extremely fast access speed
- Support for content written in markdown format
- Support search, classification, archiving and screening
- Customize website name and description, etc

**Demo:** NilTor's Blog: [https://blog.dusi.dev/](https://blog.dusi.dev/)

## 🎖️Features

- Blog list on the homepage, supporting search, category and archive filtering
- Customize website name and description
- Light and Dark themes that change with the system
- Adaptive display for mobile devices
- TOC support
- mermaid, nomnoml, Math rendering support
- Code highlighting and copy support

## 🚀Quick Start

Currently, the tool has been released in the form of 'dotnet tool'.You can easily install and use it.

### Using tools

We assume that you already have some markdown documents in the `markdown` directory.

Now we use the command:

```pwsh
ezblog init
```

Initialize a 'webinfo.json' file to configure the basic information of your blog. This file can be reused during subsequent generation.The document reads as follows:

```json
{
"Name": "Niltor Blog", // blog name, displayed at the top of the homepage navigation
"Description": "🗽 for freedom",// description, displayed in the middle of the top of the homepage
"AuthorName": "Ater", // Author name, displayed in the blog list
"BaseHref": "/blazor-blog/", // sub directory
"Domain": "https://aterdev.github.io" // Domain name, used for generating a sitemap. Leave it blank if not needed
}
```

> [!IMPORTANT]
Please note that the trailing `/` in `BaseHref` is mandatory.
>
If you have configured a custom domain name and are not using a subdirectory, set BaseHref to '/'.

Then we use the command

```pwsh
ezblog build .\markdown .\WebApp
```

This command will convert all markdown files in the 'markdown' directory into html files and generate them into the 'WebApp' directory.

You can use the `http-server` command to start a local server and view the generated content.

The 'WebApp' directory contains everything you need for a static website, and you can freely deploy it wherever you need.
41 changes: 41 additions & 0 deletions src/NodePackage/index.js
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
#!/usr/bin/env node
import dotnet from 'node-api-dotnet';
import { Command } from "commander";
import "./bin/BuildSite.js";


const Cmd = dotnet.BuildSite.Command;

const program = new Command();

program.name('ezblog')
.description('Generates a pure static blog website from a markdown document');

program.command('init')
.description('初始化webinfo.json配置文件')
.argument('[path]', '目录')
.action((path) => {
if (path == null) {
path = ''
}
Cmd.Init(path);
});


program.command('build <source> <output>')
.description('生成静态博客站点')
.argument('<source>', 'markdown文件目录')
.argument('<output>', '站点输出目录')
.action((source, output) => {
Cmd.Build(source, output);
});

program
.action(() => {
console.log('No command provided. Use --help to see available commands.');
});

program.on('--help', () => {
console.log('Generates a pure static blog website from a markdown document');
});

program.parse(process.argv);
16 changes: 15 additions & 1 deletion src/NodePackage/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
{
"name": "ater.ezblog",
"version": "0.1.0",
"bin": {
"ezblog": "./index.js"
},
"description": "Generates a pure static blog website from a markdown document through commands",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "https://github.com/AterDev/EasyBlog"
},
"homepage": "https://github.com/AterDev/EasyBlog",
"readme": "README.md",
"author": "NilTor",
"license": "MIT"
"license": "MIT",
"type": "module",
"dependencies": {
"commander": "^12.1.0",
"node-api-dotnet": "^0.7.34"
}
}
31 changes: 31 additions & 0 deletions src/NodePackage/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 143fb4e

Please sign in to comment.