Skip to content

Make link rendering more configurable#196

Merged
jaspervdj merged 1 commit intomainfrom
configurable-link-rendering
Feb 14, 2026
Merged

Make link rendering more configurable#196
jaspervdj merged 1 commit intomainfrom
configurable-link-rendering

Conversation

@jaspervdj
Copy link
Copy Markdown
Owner

@jaspervdj jaspervdj commented Feb 14, 2026

  1. Allow configuring link placement:

    • reference (default): show URLs reference-style at the bottom of each
      slide.
    • drop: Do not show the URLs at all (this only makes sense if OSC8 is
      turned on).

    For example:

      links:
        osc8: true
        placement: drop
  2. In addition to rendering OSC8 URLs on the inline links, do the same for the ones in the reference section.

  3. Underline all OSC8 links.

1.  Allow configuring link placement:

     *  `reference` (default): show URLs reference-style at the bottom of each
        slide.
     *  `drop`: Do not show the URLs at all (this only makes sense if
        [OSC8](#OSC8) is turned on).

    For example:

    ```yaml
    patat:
      links:
        osc8: true
        placement: drop
    ```

2.  In addition to rendering OSC8 URLs on the inline links, do the same for
    the ones in the reference section.

3.  Underline all OSC8 links.
@jaspervdj jaspervdj merged commit facfbb3 into main Feb 14, 2026
11 checks passed
Comment thread lib/Patat/Theme.hs
, themeCode :: !(Maybe Style)
, themeLinkText :: !(Maybe Style)
, themeLinkTarget :: !(Maybe Style)
, themeLinkOSC8 :: !(Maybe Style) -- Undocumented
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Does it make sense to use diffrent style than themeLinkTarget?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

Think of this as just extra formatting that gets applied if text gets linked using OSC8, I'm using it to always underline in that case.

| otherwise = PP.text url
hyperlink ds url (Just doc)
| dsOSC8 ds = PP.hyperlink (T.unpack url) doc
| dsOSC8 ds = themed ds themeLinkOSC8 $ PP.hyperlink (T.unpack url) doc
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

why not use already existing themeLinkTarget? I see the text would need both styles themeLink and themeLinkTarget merged, but that might be complicated.

instance A.FromJSON LinkPlacement where
parseJSON = A.withText "FromJSON LinkPlacement" $ \t -> case t of
"reference" -> pure ReferenceLinkPlacement
"drop" -> pure DropLinkPlacement
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Perhaps fail if lsOSC == false && lsPlacement == "drop"?

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

That's a good idea, I'll add a validation.

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.

2 participants