Skip to content

Conversation

@jmooring
Copy link
Member

@jmooring jmooring commented Oct 24, 2025

Fixes issues with outdir, imagesoutdir, and imagesdir when
markup.asciidocext.workingFolderCurrent is active. The prior logic
failed in several scenarios due to improper attribute derivation from the
page's relative permalink.

The updated logic now correctly handles:

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

Closes #9202
Closes #10183
Closes #10473

@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 Oct 25, 2025
@jmooring jmooring changed the title markup/asciidocext: Fix the outdir document attribute 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 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
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

This pull request standardizes the capitalization of "AsciiDoc" throughout the Hugo codebase and improves error handling in the AsciiDoc converter. The changes rename types, functions, and variables from "Asciidoc" to "AsciiDoc" for consistency, and update the error handling pattern to return explicit error messages instead of boolean values.

Key changes:

  • Renamed types and functions from Asciidoc* to AsciiDoc* for consistent capitalization
  • Changed Supports() function signature from returning bool to (bool, error)
  • Enhanced the ParseArgs method to return errors instead of logging them
  • Added comprehensive integration tests for diagram rendering across various site configurations
  • Improved the pageSubset interface with additional methods (IsPage(), Section())

Reviewed Changes

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

Show a summary per file
File Description
markup/asciidocext/internal/converter.go Renamed types to AsciiDoc*, improved error handling in ParseArgs, enhanced outdir logic for multi-host and ugly URLs
markup/asciidocext/convert.go Updated Supports() to return (bool, error), added SupportsPlantUML() function
markup/asciidocext/convert_test.go Updated test cases to handle new error returns, added cleanup helpers
markup/asciidocext/asciidoc_integration_test.go Added comprehensive integration tests for diagram rendering in various configurations
markup/markup_config/config.go Renamed AsciidocExt to AsciiDocExt in config struct
resources/page/page_markup_integration_test.go Updated test name and error handling
hugolib/*.go Updated test error handling and capitalization in comments
htesting/test_helpers.go Updated comment capitalization
Comments suppressed due to low confidence (1)

markup/asciidocext/asciidoc_integration_test.go:1

  • The resetMarkupConfig function mutates a global markup_config.Default which can lead to test pollution and race conditions if tests run in parallel. While the tests use t.Cleanup() to restore the default, the function's signature suggests it should fully restore the config but it only resets specific fields (Extensions and Attributes) regardless of their original values in the passed cfg parameter. Consider using the passed cfg to restore all fields, not just reset Extensions and Attributes to empty values.
// Copyright 2025 The Hugo Authors. All rights reserved.

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

@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch from ff8108c to a9f8b42 Compare November 1, 2025 15:11
…rent

Fixes issues with `outdir`, `imagesoutdir`, and `imagesdir` when
`markup.asciidocext.workingFolderCurrent` is active. The prior logic
failed in several scenarios due to improper attribute derivation from the
page's relative permalink.

The updated logic now correctly handles:

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

Closes gohugoio#9202
Closes gohugoio#10183
Closes gohugoio#10473
@jmooring jmooring force-pushed the fix-asciidoc-diagram-path branch 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant