Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix document to document xrefs in preview when the documents are included #872

Merged
merged 2 commits into from
Oct 11, 2024

Conversation

birdman7260
Copy link
Contributor

Refer to my comment made on the issue for details about the issue and resolution:
#425 (comment)

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: Support xref navigation in the preview #425 (comment)
    • Now that docname is set, the macros substitution is properly able to handle the xref macros when they are referencing the same document that is include::'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 UNSAFE as it is in the preview code, this way includes:: 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

@birdman7260
Copy link
Contributor Author

@ggrossetie Let me know if you want me to make a separate issue to tie this to

src/asciidocEngine.ts Outdated Show resolved Hide resolved
@ggrossetie ggrossetie merged commit ffd3ffa into asciidoctor:master Oct 11, 2024
2 checks passed
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.

Support xref navigation in the preview
2 participants