asciidoctor / asciidoctor-vscode

AsciiDoc support for Visual Studio Code using Asciidoctor
Other
340 stars 97 forks source link

xrefstyle is not honored when displaying xrefs #889

Closed r0ckarong closed 1 month ago

r0ckarong commented 5 months ago

I was trying to help with this discussion and tested the behavior in my VSCode.

This example was provided by Dan to show how to do it but in my VSCode it wouldn't work right.

= Document Title
:xrefstyle: short

See <<my-table>> for more reference.

.Title of my table
[#my-table]
|===
|data
|===

What I would expect to see is "Table 1" as the link text. I get the text from the auto-id instead.

image

The browser extension shows it correctly:

image

r0ckarong commented 5 months ago

Explicitly setting the xref as macro with the style "short" doesn't work either:

image

= Document Title
:xrefstyle: short

See <<my-table>> for more reference.

See xref:my-table[xrefstyle=short] for more reference.

.Title of my table
[#my-table]
|===
|data
|===
ggrossetie commented 5 months ago

Also related to https://github.com/asciidoctor/asciidoctor-vscode/pull/853 where we are using a custom converter for xref to support link (href) in the preview.

Basically, we don't support all the xref features and we need to implement them in the asciidoctorWebViewConverter. Feel free to open a pull request to implement the missing features. You can take a look at: https://github.com/asciidoctor/asciidoctor/blob/e070613f0932b18cfb64370a8f0b6a0831eee4cd/lib/asciidoctor/converter/html5.rb#L1131-L1154

ggrossetie commented 1 month ago

Thanks for the minimal reproduction case that was really helpful 🤗 I was able to add a test to make sure that my changes actually fixed this issue: https://github.com/asciidoctor/asciidoctor-vscode/pull/911