Skip to content

Conversation

@jmooring
Copy link
Member

@jmooring jmooring commented Oct 24, 2025

Fixes an issue where improper attribute derivation from the page's relative permalink caused failures with outdir, imagesoutdir, and imagesdir when markup.asciidocext.workingFolderCurrent is enabled. The updated logic now correctly handles:

  • Multi-byte characters
  • Multilingual multi-host sites
  • Site builds from a subdirectory
  • Pages using ugly URLs

Supports diagram caching as implemented in v3.1.0 of the asciidoctor-diagram extension:

  • Enables caching by default
  • Sets default cache location to the compiled value of caches.misc.dir

Reduces duration of integration tests by:

  • Generating GoAT diagrams instead of Ditaa diagrams
  • Taking advantage of asciidoctor-diagram caching

Closes #9202
Closes #10183
Closes #10473
Closes #14160

@jmooring jmooring marked this pull request as draft October 24, 2025 21:01
@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch 2 times, most recently from 2d57836 to de2a5fb Compare October 25, 2025 02:10
@jmooring jmooring changed the title markup/asciidocext: Unescape the outdir document attribute markup/asciidocext: Fix the outdir document attribute Oct 25, 2025
@jmooring jmooring changed the title markup/asciidocext: Fix the outdir document attribute markup/asciidocext: Fix workingFolderCurrent behavior Oct 26, 2025
@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch from de2a5fb to 90b1e91 Compare October 26, 2025 00:35
@jmooring jmooring changed the title markup/asciidocext: Fix workingFolderCurrent behavior markup/asciidocext: Correct attribute derivation for workingFolderCurrent Oct 26, 2025
@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch 2 times, most recently from f1ddbab to 859fb13 Compare October 31, 2025 19:48
@jmooring jmooring marked this pull request as ready for review October 31, 2025 19:49
@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch 2 times, most recently from 30f0802 to ff8108c Compare November 1, 2025 14:55
@jmooring jmooring requested a review from Copilot November 1, 2025 14:56

This comment was marked as outdated.

@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch 2 times, most recently from a9f8b42 to 0a3a875 Compare November 1, 2025 15:28
@jmooring
Copy link
Member Author

jmooring commented Nov 1, 2025

I'm not thrilled about the duration of the integration test (it's the second largest contributor to overall test time), but I don't want to pare it down either.

@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch from 0a3a875 to 06f8923 Compare November 13, 2025 18:49
@jmooring jmooring requested a review from Copilot November 13, 2025 18:50
Copilot finished reviewing on behalf of jmooring November 13, 2025 18:52

This comment was marked as outdated.

@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch 2 times, most recently from 23c08b7 to d334495 Compare November 13, 2025 20:07
@jmooring jmooring requested a review from Copilot November 13, 2025 20:08
Copilot finished reviewing on behalf of jmooring November 13, 2025 20:10
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 12 out of 12 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jmooring
Copy link
Member Author

jmooring commented Nov 15, 2025

most important test cases

Rebased on master. Integration test will only run when IsRealCI is true, and then only for three of the sub-tests.

if !slices.Contains([]string{"Test 4", "Test 8", "Test 16"}, tc.name) {
    continue
}

Our CI testing... 15s on Linux and 30s on Windows. Caching, plus GoAT instead of Ditaa diagrams, should make this much faster. Spinning up JRE for each diagram isn't cheap. GoAT support will be in the next asciidoctor-diagram release (PR merged yesterday).

@jmooring
Copy link
Member Author

jmooring commented Nov 16, 2025

@bep Let's hold off on this for a day or two. There's a new upstream release that implements caching and GoAT diagrams.

@jmooring jmooring changed the title markup/asciidocext: Correct attribute derivation for workingFolderCurrent markup/asciidocext: Improve Asciidoctor integration Nov 16, 2025
@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch 4 times, most recently from 0891bcf to 73a8e4b Compare November 19, 2025 02:15
@github-actions
Copy link

AI Detection Analysis 🔍

Confidence Score: 15%

Reasoning: The content in this pull request shows clear signs of human authorship, particularly due to the nuanced understanding of the Hugo framework, the AsciiDoctor ecosystem, and handling of multilingual site constructs and rendering edge cases. The implementation includes highly context-specific logic, consistent variable naming, detailed test cases, and explicit intention (e.g., skipping tests under CI or specific OS conditions). Most importantly, the test coverage illustrates deep knowledge of Hugo’s configuration and its interaction with advanced AsciiDoc features (e.g., diagram caching, multilingual URLs, diagram output directories), which currently would be difficult to fully automate using generative AI tools.

The writing in the description is polished yet technical, aligning with an experienced open source contributor familiar with Hugo and AsciiDoc internals. The highly structured test matrix with twenty complex test cases involving multilingual, uglyURLs, and baseURL edge cases, and the creation of content using idiomatic Go templating, are particularly difficult to produce via AI without overgeneralization or errors.

Key Indicators:

  • Deep Hugo internals knowledge (e.g., .Conf.CacheDirMisc(), markup config nesting, language-specific baseURL handling, etc.)
  • Manual, structured test scenarios across 20 permutations of multilingual and URL representations
  • Precision use of Go standard libraries, TOML config placeholders, and integration with Ruby-based AsciiDoctor tooling (including use of gem CLI)
  • Human-like formatting and in-line comments tailored to future maintainers and contributors
  • Strategic skips based on platform and CI environment detection (in test logic)
  • The PR exhibits design coherence and maintains Hugo's code quality and documentation standards, which is more typical of experienced maintainers than code-generating AI.

This body of work suggests deliberate engineering and domain-specific expertise far beyond current AI-generated code capabilities.

Key Indicators:

  • Complex test scenarios tailored to niche requirements (multilingual, subdirs, URI encoding)
  • Context-aware OS and environment handling with skip logic
  • Advanced error messages and inline usage documentation
  • High integration between multiple Hugo components (markup, config, testing, i18n)
  • Lack of generic or boilerplate phrasing common in LLM output
  • No signs of typical LLM limitations (hallucinated APIs, improper tagging, misunderstanding of Go syntax or Hugo config semantic model)

Conclusion: Human-authored with strong coherence and domain-specific reasoning.

✅ No strong indicators of AI generation detected

@jmooring
Copy link
Member Author

Perhaps this is a hangover from the outage(s) a few hours ago, but integration tests fail every time:

failed to execute binary "npm" with args [install]: npm warn tar TAR_ENTRY_ERROR ENOSPC: no space left on device

@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch from 73a8e4b to 602c7fd Compare November 19, 2025 14:17
@github-actions
Copy link

AI Detection Analysis 🔍

Confidence Score: 15%

Reasoning:
This pull request is highly detailed and contextually deep in domain-specific integration for Hugo's AsciiDoc support. It spans tests, conditional logic, diagrams, multilingual content, and caching—an extremely thorough and nuanced development effort. The content includes highly specific technical details such as which diagrams to use (e.g., GoAT vs. Ditaa), low-level file layout decisions, multilingual multilingualism with subdirectories and hosts, and deep knowledge of the AsciiDoctor diagram plugin implementation, including caching behavior and filesystem interactions. Automated tools may aid in generating some scaffolding, but the comprehensive nature of the implementation, test coverage, and interpretive decisions strongly suggests an experienced human developer.

Key Indicators:

  • Thoughtful treatment of multiple edge cases and site configurations, such as multilingual multi-host deployments and URL structures ("uglyURLs").
  • Deep integration across Hugo internal logic: cache directories, diagrams rendering, content pipeline, TOC extraction.
  • Custom fallback logic, error handling, and nuanced CLI checks for external binaries and gems.
  • Extensive and varied integration test scenarios, including validations for multilingual SVG outputs and exceptional path handling (e.g., UTF-8 paths like "Straßen/Frühling").
  • Rich and coherent documentation in comment blocks and structuring, showing awareness of long-term maintainability.
  • Custom test skipping logic depending on CI vs local, and OS-specific exclusions for Windows.

These reflect a level of contextual and experiential understanding not easily achievable with current AI content generators.

✅ No strong indicators of AI generation detected

@bep
Copy link
Member

bep commented Nov 19, 2025

Confidence Score: 15%

There's only a 15% chance you're not human, according to OpenAI. Running on every PR force push doesn't make sense, though ... I'll see if I can fix that.

@jmooring
Copy link
Member Author

There's only a 15% chance you're not human

Yeah, well, I'd argue the number is higher than that, but I appreciate its charitable assessment.

@jmooring
Copy link
Member Author

@bep I could use another set of eyes on this. I cannot figure out why the CI runs continue to fail. The new integration test passes:

ok  	github.com/gohugoio/hugo/markup/asciidocext	53.224s

But the job dies later in the process.

@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch from 602c7fd to 1866df0 Compare November 19, 2025 15:20
@bep
Copy link
Member

bep commented Nov 19, 2025

@jmooring I will have a look. We have had "space issues" before, which is the reason we currently do not run on Darwin. But the "free-disk-space" should work, and it's strange that it works in other PRs.

@bep
Copy link
Member

bep commented Nov 19, 2025

I have tried to narrow it down in #14190 ... This I don't understand, it must be some issue on the GitHub side of the fence. I need to look at this with a fresh head tomorrow.

@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch from 1866df0 to 47e04a5 Compare November 20, 2025 03:07
@bep
Copy link
Member

bep commented Nov 20, 2025

OK, #14196 should fix it, will merge once it goes green.

@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch from 47e04a5 to b42c932 Compare November 20, 2025 16:27
@jmooring
Copy link
Member Author

It's looks like there are still some space issues or something on Linux.

@bep
Copy link
Member

bep commented Nov 21, 2025

OK, now this issue has spread to #14197 -- which I guess also gives me a hint about what the real issue is: Test binary sizes now crossing a breaking threshold. I will see if I can find a fix.

@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch from b42c932 to 107ec7c Compare November 21, 2025 15:21
@jmooring
Copy link
Member Author

This is ready for final review.

Integration test details:

  • Generates GoAT diagrams instead of Ditaa diagrams
  • Enables the caching mechanism introduced in v3.0.1 of the asciidoctor-diagram extension
  • Runs only when IsRealCI is true
  • Runs all subtests on Linux
  • Runs 3 of the subtests on Windows

When testing locally on Linux with Ditaa diagrams, the benefits of diagram caching are obvious. When using GoAT diagrams, the benefit is less noticeable because generation is very fast. On Windows, the benefits of diagram caching for simple diagrams are negligible due to the overall slower performance of the Asciidoctor calls.

Current CI test duration:

  • Linux: ~50s (runs all 20 subtests)
  • Windows: ~30s (runs 3 of 20 subtests)

Fixes an issue where improper attribute derivation from the page's
relative permalink caused failures with `outdir`, `imagesoutdir`, and
`imagesdir` when `markup.asciidocext.workingFolderCurrent` is enabled.
The updated logic now correctly handles:

- Multi-byte characters
- Multilingual multi-host sites
- Site builds from a subdirectory
- Pages using ugly URLs

Supports diagram caching as implemented in v3.1.0 of the asciidoctor-diagram
extension:

- Enables caching by default
- Sets default cache location to the compiled value of caches.misc.dir

Reduces duration of integration tests by:

- Generating GoAT diagrams instead of Ditaa diagrams
- Taking advantage of asciidoctor-diagram caching

Closes gohugoio#9202
Closes gohugoio#10183
Closes gohugoio#10473
Closes gohugoio#14160
@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch from 107ec7c to 9886b42 Compare November 24, 2025 18:37
@bep bep merged commit 3d21b06 into gohugoio:master Nov 24, 2025
6 checks passed
@jmooring jmooring deleted the fix-asciidoc-diagram-path branch November 25, 2025 05:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants