From 58c9dea2c7db7a7cfc7bdecb69d1b68e522cf3c4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=88=9A=28noham=29=C2=B2?= <100566912+NohamR@users.noreply.github.com> Date: Sun, 1 Feb 2026 15:22:51 +0100 Subject: [PATCH] Remove demo and CI; add Hugo module files --- .github/workflows/deploy.yml | 84 ------------------- README.md | 2 +- demo/archetypes/default.md | 5 -- demo/content/posts/asm.md | 154 ----------------------------------- demo/hugo.toml | 3 - module/go.mod | 3 + module/hugo.toml | 7 ++ 7 files changed, 11 insertions(+), 247 deletions(-) delete mode 100644 .github/workflows/deploy.yml delete mode 100644 demo/archetypes/default.md delete mode 100644 demo/content/posts/asm.md delete mode 100644 demo/hugo.toml create mode 100644 module/go.mod create mode 100644 module/hugo.toml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 45590df..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -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 diff --git a/README.md b/README.md index 4e338a8..bf89150 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/demo/archetypes/default.md b/demo/archetypes/default.md deleted file mode 100644 index 25b6752..0000000 --- a/demo/archetypes/default.md +++ /dev/null @@ -1,5 +0,0 @@ -+++ -date = '{{ .Date }}' -draft = true -title = '{{ replace .File.ContentBaseName "-" " " | title }}' -+++ diff --git a/demo/content/posts/asm.md b/demo/content/posts/asm.md deleted file mode 100644 index aac7091..0000000 --- a/demo/content/posts/asm.md +++ /dev/null @@ -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 -{{}} -mov rax, 1 -xor rdi, rdi -syscall -{{}} -``` - -{{< asm mode="raw" arch="x86" >}} -mov rax, 1 -xor rdi, rdi -syscall -{{< /asm >}} - -### ARM64 basic example -```go-html-template -{{}} -mov w0, #1 -mov w1, #1 -add w2, w0, w1 -ret -{{}} -``` - -{{< asm mode="raw" arch="arm" >}} -mov w0, #1 -mov w1, #1 -add w2, w0, w1 -ret -{{< /asm >}} - - -### x86 + hex example -```go-html-template -{{}} -48 c7 c0 01 00 00 00 | mov rax, 1 -48 31 ff | xor rdi, rdi -0f 05 | syscall -{{}} -``` - -{{< 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 -{{}} -48 c7 c0 01 00 00 00 | mov rax, 1 -{{}} -``` - -{{< asm mode="hex" capitalize="true" >}} -48 c7 c0 01 00 00 00 | mov rax, 1 -{{< /asm >}} - -### Full example -```go-html-template -{{}} -00000000 | 20 00 80 52 | mov w0, #1 -00000004 | 21 00 80 52 | mov w1, #1 -00000008 | c0 03 5f d6 | ret -{{}} -``` - -{{< 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 -{{}} -00401000 | 48 c7 c0 01 00 00 00 | mov rax, 1 -00401007 | 48 31 ff | xor rdi, rdi -0040100a | 0f 05 | syscall -{{}} -``` - -{{< 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 -{{}} -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 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 -{{}} -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 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 >}} diff --git a/demo/hugo.toml b/demo/hugo.toml deleted file mode 100644 index 7e568b8..0000000 --- a/demo/hugo.toml +++ /dev/null @@ -1,3 +0,0 @@ -baseURL = 'https://example.org/' -languageCode = 'en-us' -title = 'My New Hugo Site' diff --git a/module/go.mod b/module/go.mod new file mode 100644 index 0000000..2c15150 --- /dev/null +++ b/module/go.mod @@ -0,0 +1,3 @@ +module hugo-asm-shortcode + +go 1.21 diff --git a/module/hugo.toml b/module/hugo.toml new file mode 100644 index 0000000..6618efd --- /dev/null +++ b/module/hugo.toml @@ -0,0 +1,7 @@ +[module] + [[module.mounts]] + source = "layouts" + target = "layouts" + [[module.mounts]] + source = "assets" + target = "assets"