Skip to content

Allow button directives to use Markdown link references#3443

Merged
theletterf merged 3 commits into
mainfrom
copilot/fix-button-directive-markdown-support
Jun 2, 2026
Merged

Allow button directives to use Markdown link references#3443
theletterf merged 3 commits into
mainfrom
copilot/fix-button-directive-markdown-support

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jun 2, 2026

:::{button} only accepted inline Markdown links ([text](url)), rejecting valid reference-style links such as [text][ref]. This updates button directive validation to allow both forms so referenced links render the same as direct links.

  • Directive validation

    • Broadened ButtonBlock link validation from inline-only links to a single Markdown link in either form:
      • [text](url)
      • [text][ref]
    • Kept the existing guardrails around non-link content, multiple links, and nested blocks.
  • Error guidance

    • Updated button directive error messages to show both supported link forms, so failures point users at the accepted syntax.
  • Regression coverage

    • Added a focused button directive test for a reference-style link with a trailing link definition to ensure the directive accepts and renders it.
:::{button}
[Open][kibana-url]
:::

[kibana-url]: <https://foo.example.com>

Copilot AI changed the title [WIP] Fix button directive to support Markdown link references Allow button directives to use Markdown link references Jun 2, 2026
Copilot AI requested a review from theletterf June 2, 2026 09:21
Copilot AI temporarily deployed to integration-tests June 2, 2026 09:21 Inactive
@theletterf theletterf added the fix label Jun 2, 2026
@theletterf theletterf marked this pull request as ready for review June 2, 2026 09:23
@theletterf theletterf requested a review from a team as a code owner June 2, 2026 09:23
@theletterf theletterf requested a review from reakaleek June 2, 2026 09:23
@theletterf
Copy link
Copy Markdown
Member

@copilot, also address this failing case:

:::{button}
[Logs](https://example.kb.us-west2.gcp.elastic-cloud.com/app/discover#/?_g=(filters:!(),refreshInterval:(pause:!t,value:60000),time:(from:now-15h,to:now))&_a=(columns:!(),dataSource:(type:esql),filters:!(),interval:auto,query:(esql:'FROM%20logs*,-logstash*,filebeat-*%20%7C%20WHERE%20service.name%20%3D%3D%20%22apm-oblt%22'),sort:!())&_tab=(tabId:'43c2b949-f679-43a8-bf68-9bf209c2fc5a'))
:::

If not possible, explain why.

Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jun 2, 2026

@copilot, also address this failing case:

...

I didn’t make a code change for this one because the sample isn’t a single valid link. The " in filters:!("> closes the href early, so the parser/browser see <a href="...filters:!(">Logs</a> plus trailing text outside the anchor. To make it valid, that quote needs to be encoded (%22 or &quot;), and the safest option is to use Markdown link syntax (inline or reference-style) instead of raw HTML for this URL.

@theletterf theletterf temporarily deployed to integration-tests June 2, 2026 10:00 — with GitHub Actions Inactive
@theletterf theletterf merged commit a074566 into main Jun 2, 2026
24 checks passed
@theletterf theletterf deleted the copilot/fix-button-directive-markdown-support branch June 2, 2026 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Button directive does not support Markdown link references

3 participants