asciidoctor-vscode
asciidoctor-vscode copied to clipboard
Fix document to document xrefs in preview when the documents are included
trafficstars
Refer to my comment made on the issue for details about the issue and resolution: https://github.com/asciidoctor/asciidoctor-vscode/issues/425#issuecomment-2071267886
Resolves: in a preview, when a document xref's another document and then that document include::'s the first document
The changes made:
- src/asciidocEngine.ts
- added the intrinsic attributes that were missing. These are missing because they are only intrinsically assigned when asciidoctor processes a file but we process with the input as a string. Reference the asciidoctor documentation, notice that the modifiable column calls out that these are only assignable via the API in this situation: https://github.com/asciidoctor/asciidoctor-vscode/issues/425#issuecomment-2071267886
- Now that
docnameis set, themacrossubstitution is properly able to handle the xref macros when they are referencing the same document that isinclude::'ing them
- src/test/asciidoctorWebViewConverter.test.ts
- refactored the two types of conversions to utilize a new function that creates the converter options. This applies the same intrinsic attributes solution
- also, this sets the safe mode to
UNSAFEas it is in the preview code, this wayincludes::are actually resolved - Added two tests: 1) test that the included file is able to xref into the parent file, 2) new test to make sure an included file can xref a separate included file
resolves #425