asciidoctor / asciidoctor-vscode

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

xrefstyle is not honored when displaying xrefs #889

Open r0ckarong opened 2 weeks ago

r0ckarong commented 2 weeks 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 2 weeks 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 1 week 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