mirror of
https://github.com/NohamR/hugo-asm-shortcode.git
synced 2026-02-21 18:15:42 +00:00
Remove demo and CI; add Hugo module files
This commit is contained in:
84
.github/workflows/deploy.yml
vendored
84
.github/workflows/deploy.yml
vendored
@@ -1,84 +0,0 @@
|
||||
name: Deploy Hugo Demo to GitHub Pages
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- "LICENSE"
|
||||
- "README.md"
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
hugoVersion:
|
||||
description: "Hugo Version"
|
||||
required: false
|
||||
default: "0.146.0"
|
||||
|
||||
# Allow one concurrent deployment
|
||||
concurrency:
|
||||
group: "pages"
|
||||
cancel-in-progress: true
|
||||
|
||||
# Default to bash
|
||||
defaults:
|
||||
run:
|
||||
shell: bash
|
||||
|
||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
||||
permissions:
|
||||
contents: read
|
||||
pages: write
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
# Build job
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
HUGO_VERSION: ${{ github.event.inputs.hugoVersion || '0.146.0' }}
|
||||
steps:
|
||||
- name: Install Hugo CLI
|
||||
run: |
|
||||
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
|
||||
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup Pages
|
||||
id: pages
|
||||
uses: actions/configure-pages@v5
|
||||
|
||||
- name: Copy module files to demo
|
||||
run: |
|
||||
mkdir -p demo/layouts/shortcodes
|
||||
mkdir -p demo/assets/css/extended
|
||||
cp module/layouts/shortcodes/asm.html demo/layouts/shortcodes/
|
||||
cp module/assets/css/extended/asm.css demo/assets/css/extended/
|
||||
|
||||
- name: Build with Hugo
|
||||
working-directory: ./demo
|
||||
run: |
|
||||
hugo \
|
||||
--buildDrafts --gc --minify \
|
||||
--baseURL "${{ steps.pages.outputs.base_url }}"
|
||||
|
||||
- name: Upload artifact
|
||||
uses: actions/upload-pages-artifact@v3
|
||||
with:
|
||||
path: ./demo/public
|
||||
|
||||
# Deployment job
|
||||
deploy:
|
||||
environment:
|
||||
name: github-pages
|
||||
url: ${{ steps.deployment.outputs.page_url }}
|
||||
runs-on: ubuntu-latest
|
||||
needs: build
|
||||
steps:
|
||||
- name: Deploy to GitHub Pages
|
||||
id: deployment
|
||||
uses: actions/deploy-pages@v4
|
||||
@@ -72,7 +72,7 @@ syscall
|
||||
|
||||
## Demo
|
||||
|
||||
See the `demo/` folder for a complete Hugo site example.
|
||||
See a live demo at [noh.am/en/posts/asm/](https://noh.am/en/posts/asm/)
|
||||
|
||||
## License
|
||||
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
+++
|
||||
date = '{{ .Date }}'
|
||||
draft = true
|
||||
title = '{{ replace .File.ContentBaseName "-" " " | title }}'
|
||||
+++
|
||||
@@ -1,154 +0,0 @@
|
||||
---
|
||||
title: "Adding ASM code blocks"
|
||||
date: 2026-02-01
|
||||
summary: "How to add assembly code blocks in Hugo using custom shortcodes"
|
||||
aliases: ["/posts/asm/"]
|
||||
tags: ["hugo", "asm", "assembly", "code blocks"]
|
||||
author: "Noham"
|
||||
showToc: true
|
||||
TocOpen: false
|
||||
draft: true
|
||||
hidemeta: false
|
||||
comments: true
|
||||
disableHLJS: false
|
||||
disableShare: false
|
||||
hideSummary: false
|
||||
searchHidden: true
|
||||
ShowReadingTime: true
|
||||
ShowBreadCrumbs: true
|
||||
ShowPostNavLinks: true
|
||||
ShowWordCount: true
|
||||
ShowRssButtonInSectionTermList: true
|
||||
UseHugoToc: true
|
||||
---
|
||||
|
||||
### x86 basic example
|
||||
```go-html-template
|
||||
{{</* asm mode="raw" arch="x86" */>}}
|
||||
mov rax, 1
|
||||
xor rdi, rdi
|
||||
syscall
|
||||
{{</* /asm */>}}
|
||||
```
|
||||
|
||||
{{< asm mode="raw" arch="x86" >}}
|
||||
mov rax, 1
|
||||
xor rdi, rdi
|
||||
syscall
|
||||
{{< /asm >}}
|
||||
|
||||
### ARM64 basic example
|
||||
```go-html-template
|
||||
{{</* asm mode="raw" arch="arm" */>}}
|
||||
mov w0, #1
|
||||
mov w1, #1
|
||||
add w2, w0, w1
|
||||
ret
|
||||
{{</* /asm */>}}
|
||||
```
|
||||
|
||||
{{< asm mode="raw" arch="arm" >}}
|
||||
mov w0, #1
|
||||
mov w1, #1
|
||||
add w2, w0, w1
|
||||
ret
|
||||
{{< /asm >}}
|
||||
|
||||
|
||||
### x86 + hex example
|
||||
```go-html-template
|
||||
{{</* asm mode="hex" arch="x86" */>}}
|
||||
48 c7 c0 01 00 00 00 | mov rax, 1
|
||||
48 31 ff | xor rdi, rdi
|
||||
0f 05 | syscall
|
||||
{{</* /asm */>}}
|
||||
```
|
||||
|
||||
{{< asm mode="hex" arch="x86" >}}
|
||||
48 c7 c0 01 00 00 00 | mov rax, 1
|
||||
48 31 ff | xor rdi, rdi
|
||||
0f 05 | syscall
|
||||
{{< /asm >}}
|
||||
|
||||
### Hex with capitalization
|
||||
```go-html-template
|
||||
{{</* asm mode="hex" capitalize="true" */>}}
|
||||
48 c7 c0 01 00 00 00 | mov rax, 1
|
||||
{{</* /asm */>}}
|
||||
```
|
||||
|
||||
{{< asm mode="hex" capitalize="true" >}}
|
||||
48 c7 c0 01 00 00 00 | mov rax, 1
|
||||
{{< /asm >}}
|
||||
|
||||
### Full example
|
||||
```go-html-template
|
||||
{{</* asm mode="full" arch="arm" */>}}
|
||||
00000000 | 20 00 80 52 | mov w0, #1
|
||||
00000004 | 21 00 80 52 | mov w1, #1
|
||||
00000008 | c0 03 5f d6 | ret
|
||||
{{</* /asm */>}}
|
||||
```
|
||||
|
||||
{{< asm mode="full" arch="arm" >}}
|
||||
00000000 | 20 00 80 52 | mov w0, #1
|
||||
00000004 | 21 00 80 52 | mov w1, #1
|
||||
00000008 | c0 03 5f d6 | ret
|
||||
{{< /asm >}}
|
||||
|
||||
### Full with capitalization
|
||||
```go-html-template
|
||||
{{</* asm mode="full" arch="x86" capitalize="true" */>}}
|
||||
00401000 | 48 c7 c0 01 00 00 00 | mov rax, 1
|
||||
00401007 | 48 31 ff | xor rdi, rdi
|
||||
0040100a | 0f 05 | syscall
|
||||
{{</* /asm */>}}
|
||||
```
|
||||
|
||||
{{< asm mode="full" arch="x86" capitalize="true" >}}
|
||||
00401000 | 48 c7 c0 01 00 00 00 | mov rax, 1
|
||||
00401007 | 48 31 ff | xor rdi, rdi
|
||||
0040100a | 0f 05 | syscall
|
||||
{{< /asm >}}
|
||||
|
||||
### ARM64 with hex bytes
|
||||
```go-html-template
|
||||
{{</* asm mode="hex" arch="arm" */>}}
|
||||
20 00 80 52 | mov w0, #1
|
||||
21 00 80 52 | mov w1, #1
|
||||
42 00 01 0b | add w2, w2, w1
|
||||
c0 03 5f d6 | ret
|
||||
{{</* /asm */>}}
|
||||
```
|
||||
|
||||
{{< asm mode="hex" arch="arm" >}}
|
||||
20 00 80 52 | mov w0, #1
|
||||
21 00 80 52 | mov w1, #1
|
||||
42 00 01 0b | add w2, w2, w1
|
||||
c0 03 5f d6 | ret
|
||||
{{< /asm >}}
|
||||
|
||||
### Longer x86 function example
|
||||
```go-html-template
|
||||
{{</* asm mode="full" arch="x86" */>}}
|
||||
00401000 | 55 | push rbp
|
||||
00401001 | 48 89 e5 | mov rbp, rsp
|
||||
00401004 | 48 83 ec 10 | sub rsp, 0x10
|
||||
00401008 | 89 7d fc | mov [rbp-0x4], edi
|
||||
0040100b | 8b 45 fc | mov eax, [rbp-0x4]
|
||||
0040100e | 83 c0 01 | add eax, 0x1
|
||||
00401011 | c9 | leave
|
||||
00401012 | c3 | ret
|
||||
{{</* /asm */>}}
|
||||
```
|
||||
|
||||
{{< asm mode="full" arch="x86" >}}
|
||||
00401000 | 55 | push rbp
|
||||
00401001 | 48 89 e5 | mov rbp, rsp
|
||||
00401004 | 48 83 ec 10 | sub rsp, 0x10
|
||||
00401008 | 89 7d fc | mov [rbp-0x4], edi
|
||||
0040100b | 8b 45 fc | mov eax, [rbp-0x4]
|
||||
0040100e | 83 c0 01 | add eax, 0x1
|
||||
00401011 | c9 | leave
|
||||
00401012 | c3 | ret
|
||||
{{< /asm >}}
|
||||
@@ -1,3 +0,0 @@
|
||||
baseURL = 'https://example.org/'
|
||||
languageCode = 'en-us'
|
||||
title = 'My New Hugo Site'
|
||||
3
module/go.mod
Normal file
3
module/go.mod
Normal file
@@ -0,0 +1,3 @@
|
||||
module hugo-asm-shortcode
|
||||
|
||||
go 1.21
|
||||
7
module/hugo.toml
Normal file
7
module/hugo.toml
Normal file
@@ -0,0 +1,7 @@
|
||||
[module]
|
||||
[[module.mounts]]
|
||||
source = "layouts"
|
||||
target = "layouts"
|
||||
[[module.mounts]]
|
||||
source = "assets"
|
||||
target = "assets"
|
||||
Reference in New Issue
Block a user