Skip to content

MarkdownCte: Add option to show actual urls along with anchor text #261

Description

@tig

Summary

When printing Markdown, hyperlinks currently render as colored anchor text only — the destination URL is discarded. On paper (and in PDFs shared offline) that loses the useful part of the link. Add a Markdown CTE option to emit the URL alongside (or instead of-only) the anchor text.

Current behavior

In MarkdownCte.FlattenInlines, a LinkInline is flattened to its child text in link color; the Url is never emitted:

case LinkInline link:
    FlattenInlines(link, scale, style, LinkColor, tokens);
    break;
case AutolinkInline auto:
    AppendText(auto.Url, scale, style, LinkColor, tokens);
    break;

So [GitHub Pages](https://pages.github.com/) prints as blue GitHub Pages, while bare autolinks already show the URL.

Settings already live on MarkdownCte (RenderMermaidDiagrams, MermaidBackend, …) and are copied via CopyPropertiesFrom / persisted under markdownContentTypeEngineSettings in WinPrint.config.json.

Proposed behavior

Add a boolean setting (name TBD), e.g. ShowLinkUrls (default false to preserve today’s look):

Markdown Today With option on
[GitHub Pages](https://pages.github.com/) GitHub Pages GitHub Pages (https://pages.github.com/)
<https://example.com> / autolink URL (unchanged) URL (unchanged)
[same as url](https://example.com) text Prefer not duplicating if anchor text equals URL

Suggested formatting (open to bikeshed):

  • anchor text (url) after the link text, same scale/style, still in link color (or dimmer for the parenthetical).
  • Skip when link.Url is empty/null.
  • Skip (or don’t double) when normalized anchor text equals the URL.
  • Images (link.IsImage) stay out of scope.

Scope

  • New property on MarkdownCte + CopyPropertiesFrom
  • Persist via existing engine settings path
  • Emit URL in the LinkInline flatten path
  • Unit test(s) with RecordingGraphicsContext / existing Markdown CTE tests
  • Optional: TUI/GUI toggle later; config-only is fine for v1

Why

Print is the product’s job: clickable styling doesn’t help on a physical page or a static PDF. Showing destinations is a common “print-friendly links” feature and matches how many “print stylesheet” / “readable print” tools behave.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions