Skip to content

Support for markdown output in help messages - #30

Open
mgrojo wants to merge 11 commits into
alire-project:mainfrom
mgrojo:feat/markdown-help
Open

Support for markdown output in help messages#30
mgrojo wants to merge 11 commits into
alire-project:mainfrom
mgrojo:feat/markdown-help

Conversation

@mgrojo

@mgrojo mgrojo commented Sep 23, 2023

Copy link
Copy Markdown

Users of CLIC can use this functionality to provide on-line versions of the help messages.

Users of CLIC can use this functionality to provide on-line versions of the
help messages.
* For consistency with other chapters
* It fixes `pandoc` output
The list of options got a line break after each option except for the
longest line. The reason is that two or more spaces at the end of a line
makes a hard line break in Markdown, but the longest line does not get
any padding at the right. This ensures the line break.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces Markdown-friendly formatting for CLIC help/usage output so applications can publish help pages online while still supporting rich TTY formatting.

Changes:

  • Added CLIC.Markdown (Markdown formatting helpers) and CLIC.Markup (runtime switch between TTY and Markdown formatting).
  • Extended CLIC.Subcommand.Instance formatting interface with TTY_Terminal and adjusted help/usage rendering to use it in key places.
  • Updated the example app to add a --markdown flag and route formatting through CLIC.Markup.

Reviewed changes

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

Show a summary per file
File Description
src/clic-tty.ads Fixes a typo in a TTY comment.
src/clic-subcommand.ads Minor comment typo fixes around help-topic docs.
src/clic-subcommand-instance.ads Adds TTY_Terminal generic formal and new iteration APIs.
src/clic-subcommand-instance.adb Uses TTY_Terminal in help/usage and adds iteration implementations.
src/clic-markup.ads New facade API to switch between TTY and Markdown output.
src/clic-markup.adb Implements runtime selection between CLIC.TTY and CLIC.Markdown.
src/clic-markdown.ads New Markdown formatting function declarations.
src/clic-markdown.adb New Markdown formatting function implementations.
src/clic-config.ads Fixes a typo in a comment.
example/src/clic_ex-commands.ads Switches example instantiation to use CLIC.Markup and provides TTY_Terminal.
example/src/clic_ex-commands.adb Adds --markdown switch and toggles Markdown formatting.
example/src/clic_ex-commands-subsub.adb Updates subcommand instantiation to use CLIC.Markup + TTY_Terminal.

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

Comment thread src/clic-markdown.adb Outdated
Comment thread src/clic-markdown.adb
Comment thread src/clic-subcommand-instance.ads
Comment on lines +97 to +105
procedure Iterate_Commands
(Process : not null access procedure
(Group : Ada.Strings.Unbounded.Unbounded_String;
Cmd : not null Command_Access));
-- Iterate over all registered commands sorted by group applying Process

procedure Iterate_Topics
(Process : not null access procedure (Cmd : not null Help_Topic_Access));
-- Iterate all registered topics applying Process
Comment thread src/clic-subcommand-instance.ads Outdated
Comment thread src/clic-subcommand.ads Outdated
mosteo and others added 2 commits May 11, 2026 14:50
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants