Add asciidoc output option to docs-builder changelog render command #2452
+646
−31
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
--file-typeoption tochangelog rendercommandOverview
Added support for rendering changelogs to asciidoc format in addition to markdown.
The
docs-builder changelog rendercommand now accepts a--file-typeoption that can output either markdown (default) or asciidoc files.This functionality is based on the "--file_type" option in https://github.com/elastic/elastic-agent-changelog-tool and the
gradlew generateReleaseNotescommand in the 8.19 branch of the elasticsearch repo.Examples
4. Refresh the binaries, per https://github.com/elastic/docs-builder/blob/main/README.md. For example:
./build.sh clean ./build.sh publishbinaries cd .artifacts/publish/docs-builder/release/changelog addcommand:```sh
./docs-builder changelog add --prs ~/path/to/8.19.10.txt --repo elasticsearch --owner elastic --products "elasticsearch 8.19.10" --config ~/path/to/changelog.yml --output ~/path/to/elasticsearch/docs/changelog/new/
The resulting file in this case is as follows:
When it is substituted for the existing file, it renders successfully. For example:
Code changes
1. Command Interface (
src/tooling/docs-builder/Commands/ChangelogCommand.cs)--file-typeparameter to theRendercommandfile-typeis either"markdown"or"asciidoc"2. Input Model (
src/services/Elastic.Documentation.Services/Changelog/ChangelogRenderInput.cs)FileTypeproperty (defaults to"markdown")3. Service Implementation (
src/services/Elastic.Documentation.Services/ChangelogService.cs)New Methods:
RenderAsciidoc()- Main method that generates a single asciidoc file with all sectionsRenderEntriesByAreaAsciidoc()- Renders entries grouped by component/area in asciidoc formatRenderBreakingChangesAsciidoc()- Renders breaking changes in asciidoc formatRenderDeprecationsAsciidoc()- Renders deprecations in asciidoc formatRenderKnownIssuesAsciidoc()- Renders known issues in asciidoc formatFormatPrLinkAsciidoc()- Formats PR links as asciidoc attribute referencesFormatIssueLinkAsciidoc()- Formats issue links as asciidoc attribute referencesConvertRepoToAttributeName()- Converts repository names to asciidoc attribute formatModified methods
RenderChangelogs()- Updated to route to appropriate renderer based onfile-type:asciidoc: callsRenderAsciidoc()to generate a single.asciidocfilemarkdown(default): calls existing markdown renderers to generate multiple.mdfiles4. Asciidoc format details
The asciidoc output follows patterns from Elasticsearch release notes:
[float]attributes for subsections::(e.g.,Data streams::){repo-pull}NUMBER[#NUMBER]and{repo-issue}NUMBER[#NUMBER]Documentation updates
1.
docs/cli/release/changelog-render.md--file-typeoption documentationindex.md,breaking-changes.md,deprecations.md,known-issues.md).asciidocfile with all sections2.
docs/contribute/changelog.md--file-typeoption--file-type asciidocusageTesting
Usage Examples
Markdown (default):
docs-builder changelog render \ --input "./changelog-bundle.yaml,./changelogs,elasticsearch" \ --title 9.2.2 \ --output ./release-notesAsciidoc:
docs-builder changelog render \ --input "./changelog-bundle.yaml,./changelogs,elasticsearch" \ --title 9.2.2 \ --output ./release-notes \ --file-type asciidocBackward Compatibility
--file-typedefaults to"markdown"if not specifiedGenerative AI disclosure
Tool(s) and model(s) used: composer-1 agent