Compare commits
12 Commits
v0.1.2
...
aca2b367b1
Author | SHA1 | Date | |
---|---|---|---|
aca2b367b1
|
|||
41c95a9122
|
|||
e1eb04620e
|
|||
eb3feffd70
|
|||
bb7e4ea01d
|
|||
11f1b57a2d
|
|||
e033e8cc71
|
|||
9957d5efc1
|
|||
d458e53c79
|
|||
2838e494d6
|
|||
5838adf5a6
|
|||
f52249c292
|
51
.github/workflows/build-binary.yml
vendored
51
.github/workflows/build-binary.yml
vendored
@@ -1,51 +0,0 @@
|
|||||||
name: Build Binary
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch: # Manual trigger
|
|
||||||
push:
|
|
||||||
branches: [ main ]
|
|
||||||
paths:
|
|
||||||
- 'src/**'
|
|
||||||
- 'Cargo.toml'
|
|
||||||
- 'Cargo.lock'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Setup Rust
|
|
||||||
uses: actions-rs/toolchain@v1
|
|
||||||
with:
|
|
||||||
toolchain: stable
|
|
||||||
override: true
|
|
||||||
|
|
||||||
- name: Cache cargo registry
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/registry
|
|
||||||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Cache cargo index
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ~/.cargo/git
|
|
||||||
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Cache target directory
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: target
|
|
||||||
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
|
|
||||||
|
|
||||||
- name: Build binary
|
|
||||||
run: cargo build --release
|
|
||||||
|
|
||||||
- name: Upload binary
|
|
||||||
uses: actions/upload-artifact@v4
|
|
||||||
with:
|
|
||||||
name: ailog-linux
|
|
||||||
path: target/release/ailog
|
|
||||||
retention-days: 30
|
|
54
.github/workflows/cloudflare-pages.yml
vendored
54
.github/workflows/cloudflare-pages.yml
vendored
@@ -38,18 +38,60 @@ jobs:
|
|||||||
cp -r oauth/dist/assets/* my-blog/static/assets/
|
cp -r oauth/dist/assets/* my-blog/static/assets/
|
||||||
cp oauth/dist/index.html my-blog/static/oauth/index.html || true
|
cp oauth/dist/index.html my-blog/static/oauth/index.html || true
|
||||||
|
|
||||||
- name: Setup Rust
|
- name: Cache ailog binary
|
||||||
uses: actions-rs/toolchain@v1
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
toolchain: stable
|
path: ./bin
|
||||||
|
key: ailog-bin-${{ runner.os }}
|
||||||
|
restore-keys: |
|
||||||
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
- name: Build ailog
|
- name: Setup ailog binary
|
||||||
run: cargo build --release
|
run: |
|
||||||
|
# Get expected version from Cargo.toml
|
||||||
|
EXPECTED_VERSION=$(grep '^version' Cargo.toml | cut -d'"' -f2)
|
||||||
|
echo "Expected version from Cargo.toml: $EXPECTED_VERSION"
|
||||||
|
|
||||||
|
# Check current binary version if exists
|
||||||
|
if [ -f "./bin/ailog" ]; then
|
||||||
|
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
|
echo "Current binary version: $CURRENT_VERSION"
|
||||||
|
else
|
||||||
|
CURRENT_VERSION="none"
|
||||||
|
echo "No binary found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check OS
|
||||||
|
OS="${{ runner.os }}"
|
||||||
|
echo "Runner OS: $OS"
|
||||||
|
|
||||||
|
# Use pre-packaged binary if version matches or extract from tar.gz
|
||||||
|
if [ "$CURRENT_VERSION" = "$EXPECTED_VERSION" ]; then
|
||||||
|
echo "Binary is up to date"
|
||||||
|
chmod +x ./bin/ailog
|
||||||
|
elif [ "$OS" = "Linux" ] && [ -f "./bin/ailog-linux-x86_64.tar.gz" ]; then
|
||||||
|
echo "Extracting ailog from pre-packaged tar.gz..."
|
||||||
|
cd bin
|
||||||
|
tar -xzf ailog-linux-x86_64.tar.gz
|
||||||
|
chmod +x ailog
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# Verify extracted version
|
||||||
|
EXTRACTED_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
|
echo "Extracted binary version: $EXTRACTED_VERSION"
|
||||||
|
|
||||||
|
if [ "$EXTRACTED_VERSION" != "$EXPECTED_VERSION" ]; then
|
||||||
|
echo "Warning: Binary version mismatch. Expected $EXPECTED_VERSION but got $EXTRACTED_VERSION"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: No suitable binary found for OS: $OS"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Build site with ailog
|
- name: Build site with ailog
|
||||||
run: |
|
run: |
|
||||||
cd my-blog
|
cd my-blog
|
||||||
../target/release/ailog build
|
../bin/ailog build
|
||||||
|
|
||||||
- name: List public directory
|
- name: List public directory
|
||||||
run: |
|
run: |
|
||||||
|
92
.github/workflows/disabled/gh-pages-fast.yml
vendored
Normal file
92
.github/workflows/disabled/gh-pages-fast.yml
vendored
Normal file
@@ -0,0 +1,92 @@
|
|||||||
|
name: github pages (fast)
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
paths-ignore:
|
||||||
|
- 'src/**'
|
||||||
|
- 'Cargo.toml'
|
||||||
|
- 'Cargo.lock'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Cache ailog binary
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ./bin
|
||||||
|
key: ailog-bin-${{ runner.os }}
|
||||||
|
restore-keys: |
|
||||||
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
|
- name: Setup ailog binary
|
||||||
|
run: |
|
||||||
|
# Get expected version from Cargo.toml
|
||||||
|
EXPECTED_VERSION=$(grep '^version' Cargo.toml | cut -d'"' -f2)
|
||||||
|
echo "Expected version from Cargo.toml: $EXPECTED_VERSION"
|
||||||
|
|
||||||
|
# Check current binary version if exists
|
||||||
|
if [ -f "./bin/ailog" ]; then
|
||||||
|
CURRENT_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
|
echo "Current binary version: $CURRENT_VERSION"
|
||||||
|
else
|
||||||
|
CURRENT_VERSION="none"
|
||||||
|
echo "No binary found"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Check OS
|
||||||
|
OS="${{ runner.os }}"
|
||||||
|
echo "Runner OS: $OS"
|
||||||
|
|
||||||
|
# Use pre-packaged binary if version matches or extract from tar.gz
|
||||||
|
if [ "$CURRENT_VERSION" = "$EXPECTED_VERSION" ]; then
|
||||||
|
echo "Binary is up to date"
|
||||||
|
chmod +x ./bin/ailog
|
||||||
|
elif [ "$OS" = "Linux" ] && [ -f "./bin/ailog-linux-x86_64.tar.gz" ]; then
|
||||||
|
echo "Extracting ailog from pre-packaged tar.gz..."
|
||||||
|
cd bin
|
||||||
|
tar -xzf ailog-linux-x86_64.tar.gz
|
||||||
|
chmod +x ailog
|
||||||
|
cd ..
|
||||||
|
|
||||||
|
# Verify extracted version
|
||||||
|
EXTRACTED_VERSION=$(./bin/ailog --version 2>/dev/null || echo "unknown")
|
||||||
|
echo "Extracted binary version: $EXTRACTED_VERSION"
|
||||||
|
|
||||||
|
if [ "$EXTRACTED_VERSION" != "$EXPECTED_VERSION" ]; then
|
||||||
|
echo "Warning: Binary version mismatch. Expected $EXPECTED_VERSION but got $EXTRACTED_VERSION"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Error: No suitable binary found for OS: $OS"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Setup Hugo
|
||||||
|
uses: peaceiris/actions-hugo@v3
|
||||||
|
with:
|
||||||
|
hugo-version: "0.139.2"
|
||||||
|
extended: true
|
||||||
|
|
||||||
|
- name: Build with ailog
|
||||||
|
env:
|
||||||
|
TZ: "Asia/Tokyo"
|
||||||
|
run: |
|
||||||
|
# Use pre-built ailog binary instead of cargo build
|
||||||
|
cd my-blog
|
||||||
|
../bin/ailog build
|
||||||
|
touch ./public/.nojekyll
|
||||||
|
|
||||||
|
- name: Deploy
|
||||||
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
|
with:
|
||||||
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
publish_dir: ./my-blog/public
|
||||||
|
publish_branch: gh-pages
|
77
.github/workflows/gh-pages-fast.yml
vendored
77
.github/workflows/gh-pages-fast.yml
vendored
@@ -1,77 +0,0 @@
|
|||||||
name: github pages (fast)
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
paths-ignore:
|
|
||||||
- 'src/**'
|
|
||||||
- 'Cargo.toml'
|
|
||||||
- 'Cargo.lock'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-deploy:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- name: Cache ailog binary
|
|
||||||
uses: actions/cache@v4
|
|
||||||
with:
|
|
||||||
path: ./bin
|
|
||||||
key: ailog-bin-${{ runner.os }}
|
|
||||||
restore-keys: |
|
|
||||||
ailog-bin-${{ runner.os }}
|
|
||||||
|
|
||||||
- name: Check and update ailog binary
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
# Get latest release version
|
|
||||||
LATEST_VERSION=$(curl -s -H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
||||||
https://api.github.com/repos/${{ github.repository }}/releases/latest | jq -r .tag_name)
|
|
||||||
echo "Latest version: $LATEST_VERSION"
|
|
||||||
|
|
||||||
# Check current binary version if exists
|
|
||||||
mkdir -p ./bin
|
|
||||||
if [ -f "./bin/ailog" ]; then
|
|
||||||
CURRENT_VERSION=$(./bin/ailog --version | awk '{print $2}' || echo "unknown")
|
|
||||||
echo "Current version: $CURRENT_VERSION"
|
|
||||||
else
|
|
||||||
CURRENT_VERSION="none"
|
|
||||||
echo "No binary found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download if version is different or binary doesn't exist
|
|
||||||
if [ "$CURRENT_VERSION" != "${LATEST_VERSION#v}" ]; then
|
|
||||||
echo "Downloading ailog $LATEST_VERSION..."
|
|
||||||
curl -sL -H "Authorization: Bearer $GITHUB_TOKEN" \
|
|
||||||
https://github.com/${{ github.repository }}/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf -
|
|
||||||
mv ailog ./bin/ailog
|
|
||||||
chmod +x ./bin/ailog
|
|
||||||
echo "Updated to version: $(./bin/ailog --version)"
|
|
||||||
else
|
|
||||||
echo "Binary is up to date"
|
|
||||||
chmod +x ./bin/ailog
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Setup Hugo
|
|
||||||
uses: peaceiris/actions-hugo@v3
|
|
||||||
with:
|
|
||||||
hugo-version: "0.139.2"
|
|
||||||
extended: true
|
|
||||||
|
|
||||||
- name: Build with ailog
|
|
||||||
env:
|
|
||||||
TZ: "Asia/Tokyo"
|
|
||||||
run: |
|
|
||||||
# Use pre-built ailog binary instead of cargo build
|
|
||||||
./bin/ailog build --output ./public
|
|
||||||
touch ./public/.nojekyll
|
|
||||||
|
|
||||||
- name: Deploy
|
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
|
||||||
with:
|
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
publish_dir: ./public
|
|
||||||
publish_branch: gh-pages
|
|
15
.github/workflows/release.yml
vendored
15
.github/workflows/release.yml
vendored
@@ -11,6 +11,10 @@ on:
|
|||||||
required: true
|
required: true
|
||||||
default: 'v0.1.0'
|
default: 'v0.1.0'
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
actions: read
|
||||||
|
|
||||||
env:
|
env:
|
||||||
CARGO_TERM_COLOR: always
|
CARGO_TERM_COLOR: always
|
||||||
OPENSSL_STATIC: true
|
OPENSSL_STATIC: true
|
||||||
@@ -103,14 +107,15 @@ jobs:
|
|||||||
uses: actions/upload-artifact@v4
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: ${{ matrix.asset_name }}
|
name: ${{ matrix.asset_name }}
|
||||||
path: |
|
path: ${{ matrix.asset_name }}.tar.gz
|
||||||
${{ matrix.asset_name }}.tar.gz
|
|
||||||
${{ matrix.asset_name }}.zip
|
|
||||||
|
|
||||||
release:
|
release:
|
||||||
name: Create Release
|
name: Create Release
|
||||||
needs: build
|
needs: build
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
actions: read
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
@@ -159,8 +164,6 @@ jobs:
|
|||||||
body_path: release_notes.md
|
body_path: release_notes.md
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: ${{ contains(steps.tag_name.outputs.tag, 'alpha') || contains(steps.tag_name.outputs.tag, 'beta') || contains(steps.tag_name.outputs.tag, 'rc') }}
|
prerelease: ${{ contains(steps.tag_name.outputs.tag, 'alpha') || contains(steps.tag_name.outputs.tag, 'beta') || contains(steps.tag_name.outputs.tag, 'rc') }}
|
||||||
files: |
|
files: artifacts/*/ailog-*.tar.gz
|
||||||
artifacts/*/ailog-*.tar.gz
|
|
||||||
artifacts/*/ailog-*.zip
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
@@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ailog"
|
name = "ailog"
|
||||||
version = "0.1.0"
|
version = "0.1.4"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
authors = ["syui"]
|
authors = ["syui"]
|
||||||
description = "A static blog generator with AI features"
|
description = "A static blog generator with AI features"
|
||||||
|
62
action.yml
62
action.yml
@@ -55,50 +55,27 @@ runs:
|
|||||||
restore-keys: |
|
restore-keys: |
|
||||||
ailog-bin-${{ runner.os }}
|
ailog-bin-${{ runner.os }}
|
||||||
|
|
||||||
- name: Check and update ailog binary
|
- name: Setup ailog binary
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
# Get latest release version (for Gitea, adjust API endpoint if needed)
|
# Check if pre-built binary exists
|
||||||
if command -v curl >/dev/null 2>&1; then
|
if [ -f "./bin/ailog-linux-x86_64" ]; then
|
||||||
LATEST_VERSION=$(curl -s https://api.github.com/repos/syui/ailog/releases/latest | jq -r .tag_name 2>/dev/null || echo "v0.1.1")
|
echo "Using pre-built binary from repository"
|
||||||
|
chmod +x ./bin/ailog-linux-x86_64
|
||||||
|
CURRENT_VERSION=$(./bin/ailog-linux-x86_64 --version 2>/dev/null || echo "unknown")
|
||||||
|
echo "Binary version: $CURRENT_VERSION"
|
||||||
else
|
else
|
||||||
LATEST_VERSION="v0.1.1" # fallback version
|
echo "No pre-built binary found, trying to build from source..."
|
||||||
fi
|
|
||||||
echo "Target version: $LATEST_VERSION"
|
|
||||||
|
|
||||||
# Check current binary version if exists
|
|
||||||
mkdir -p ./bin
|
|
||||||
if [ -f "./bin/ailog" ]; then
|
|
||||||
CURRENT_VERSION=$(./bin/ailog --version | awk '{print $2}' 2>/dev/null || echo "unknown")
|
|
||||||
echo "Current version: $CURRENT_VERSION"
|
|
||||||
else
|
|
||||||
CURRENT_VERSION="none"
|
|
||||||
echo "No binary found"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Download if version is different or binary doesn't exist
|
|
||||||
if [ "$CURRENT_VERSION" != "${LATEST_VERSION#v}" ]; then
|
|
||||||
echo "Downloading ailog $LATEST_VERSION..."
|
|
||||||
# Try GitHub first, then fallback to local build
|
|
||||||
if curl -sL https://github.com/syui/ailog/releases/download/$LATEST_VERSION/ailog-linux-x86_64.tar.gz | tar -xzf - 2>/dev/null; then
|
|
||||||
mv ailog ./bin/ailog
|
|
||||||
chmod +x ./bin/ailog
|
|
||||||
echo "Downloaded binary: $(./bin/ailog --version)"
|
|
||||||
else
|
|
||||||
echo "Download failed, building from source..."
|
|
||||||
if command -v cargo >/dev/null 2>&1; then
|
if command -v cargo >/dev/null 2>&1; then
|
||||||
cargo build --release
|
cargo build --release
|
||||||
cp ./target/release/ailog ./bin/ailog
|
mkdir -p ./bin
|
||||||
echo "Built from source: $(./bin/ailog --version)"
|
cp ./target/release/ailog ./bin/ailog-linux-x86_64
|
||||||
|
echo "Built from source: $(./bin/ailog-linux-x86_64 --version 2>/dev/null)"
|
||||||
else
|
else
|
||||||
echo "Error: Neither download nor cargo build available"
|
echo "Error: No binary found and cargo not available"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
echo "Binary is up to date"
|
|
||||||
chmod +x ./bin/ailog
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Setup Node.js for OAuth app
|
- name: Setup Node.js for OAuth app
|
||||||
if: ${{ inputs.atproto-integration == 'true' }}
|
if: ${{ inputs.atproto-integration == 'true' }}
|
||||||
@@ -123,12 +100,15 @@ runs:
|
|||||||
run: |
|
run: |
|
||||||
start_time=$(date +%s)
|
start_time=$(date +%s)
|
||||||
|
|
||||||
./bin/ailog build \
|
# Change to blog directory and run build
|
||||||
--content ${{ inputs.content-dir }} \
|
# Note: ailog build only takes a path argument, not options
|
||||||
--output ${{ inputs.output-dir }} \
|
if [ -d "my-blog" ]; then
|
||||||
--templates ${{ inputs.template-dir }} \
|
cd my-blog
|
||||||
--static ${{ inputs.static-dir }} \
|
../bin/ailog-linux-x86_64 build
|
||||||
--config ${{ inputs.config-file }}
|
else
|
||||||
|
# If no my-blog directory, use current directory
|
||||||
|
./bin/ailog-linux-x86_64 build .
|
||||||
|
fi
|
||||||
|
|
||||||
end_time=$(date +%s)
|
end_time=$(date +%s)
|
||||||
build_time=$((end_time - start_time))
|
build_time=$((end_time - start_time))
|
||||||
|
BIN
bin/ailog-linux-x86_64.tar.gz
Normal file
BIN
bin/ailog-linux-x86_64.tar.gz
Normal file
Binary file not shown.
@@ -517,25 +517,21 @@ a.view-markdown:any-link {
|
|||||||
margin: 16px 0;
|
margin: 16px 0;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
|
||||||
position: relative;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* File name display for code blocks */
|
/* File name display for code blocks - top bar style */
|
||||||
.article-body pre[data-filename]::before {
|
.article-body pre[data-filename]::before {
|
||||||
content: attr(data-filename);
|
content: attr(data-filename);
|
||||||
position: absolute;
|
display: block;
|
||||||
top: 0;
|
|
||||||
right: 0;
|
|
||||||
background: #2D2D30;
|
background: #2D2D30;
|
||||||
color: #CCCCCC;
|
color: #AE81FF;
|
||||||
padding: 4px 12px;
|
padding: 8px 16px;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
|
font-family: 'SF Mono', 'Monaco', 'Cascadia Code', 'Roboto Mono', monospace;
|
||||||
border-bottom-left-radius: 4px;
|
border-bottom: 1px solid #3E3D32;
|
||||||
border: 1px solid #3E3D32;
|
margin: 0;
|
||||||
border-top: none;
|
width: 100%;
|
||||||
border-right: none;
|
box-sizing: border-box;
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.article-body pre code {
|
.article-body pre code {
|
||||||
@@ -548,6 +544,11 @@ a.view-markdown:any-link {
|
|||||||
line-height: 1.4;
|
line-height: 1.4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Adjust padding when filename is present */
|
||||||
|
.article-body pre[data-filename] code {
|
||||||
|
padding: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
/* Inline code (not in pre blocks) */
|
/* Inline code (not in pre blocks) */
|
||||||
.article-body code {
|
.article-body code {
|
||||||
background: var(--light-white);
|
background: var(--light-white);
|
||||||
@@ -853,6 +854,16 @@ a.view-markdown:any-link {
|
|||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Mobile filename display */
|
||||||
|
.article-body pre[data-filename]::before {
|
||||||
|
padding: 6px 12px;
|
||||||
|
font-size: 11px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.article-body pre[data-filename] code {
|
||||||
|
padding: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
.article-body code {
|
.article-body code {
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
}
|
}
|
||||||
|
21
src/main.rs
21
src/main.rs
@@ -18,10 +18,14 @@ mod mcp;
|
|||||||
#[derive(Parser)]
|
#[derive(Parser)]
|
||||||
#[command(name = "ailog")]
|
#[command(name = "ailog")]
|
||||||
#[command(about = "A static blog generator with AI features")]
|
#[command(about = "A static blog generator with AI features")]
|
||||||
#[command(version)]
|
#[command(disable_version_flag = true)]
|
||||||
struct Cli {
|
struct Cli {
|
||||||
|
/// Print version information
|
||||||
|
#[arg(short = 'V', long = "version")]
|
||||||
|
version: bool,
|
||||||
|
|
||||||
#[command(subcommand)]
|
#[command(subcommand)]
|
||||||
command: Commands,
|
command: Option<Commands>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Subcommand)]
|
#[derive(Subcommand)]
|
||||||
@@ -136,7 +140,18 @@ enum OauthCommands {
|
|||||||
async fn main() -> Result<()> {
|
async fn main() -> Result<()> {
|
||||||
let cli = Cli::parse();
|
let cli = Cli::parse();
|
||||||
|
|
||||||
match cli.command {
|
// Handle version flag
|
||||||
|
if cli.version {
|
||||||
|
println!("{}", env!("CARGO_PKG_VERSION"));
|
||||||
|
return Ok(());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Require subcommand if no version flag
|
||||||
|
let command = cli.command.ok_or_else(|| {
|
||||||
|
anyhow::anyhow!("No subcommand provided. Use --help for usage information.")
|
||||||
|
})?;
|
||||||
|
|
||||||
|
match command {
|
||||||
Commands::Init { path } => {
|
Commands::Init { path } => {
|
||||||
commands::init::execute(path).await?;
|
commands::init::execute(path).await?;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user