asciidoctor / asciidoctor-vscode

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

add doc role when the asciidoc page is used in an antora context #845

Closed lask79 closed 9 months ago

lask79 commented 9 months ago

Resolves #844

ggrossetie commented 9 months ago

Would you be able to add a test case in https://github.com/asciidoctor/asciidoctor-vscode/blob/master/src/test/asciidoctorWebViewConverter.test.ts to test with and without an antoraDocumentContext?

lask79 commented 9 months ago

Sure I will try to do that

lask79 commented 9 months ago

I added testcases but I cannot test them locally so please run the test and tell me if there needs to be changed something.

I am getting the following error when I run the tests (independent from my change): Exit code: SIGTRAP

I am currently woring on a WSL2 - Ubuntu Image with VSCode Remote Development. Maybe that is related.

lask79 commented 9 months ago

Ok, I am now able to run the Tests using the debugger. Now I have to figure out to test the content div. I will take a look later.

ggrossetie commented 9 months ago

The reason is that we are using const html = processor.convert(input, { converter: asciidoctorWebViewConverter }). In this case, Asciidoctor will convert inline markup: https://docs.asciidoctor.org/asciidoctor/latest/api/convert-strings/#convert-inline-markup-only

You should create a new test case to convert a standalone document: https://docs.asciidoctor.org/asciidoctor/latest/api/convert-strings/#standalone-output

const html = processor.convert(input, { converter: asciidoctorWebViewConverter, standalone: true })
lask79 commented 9 months ago

fixed tests

lask79 commented 9 months ago

@ggrossetie Is anything missing from my side to merge this?

ggrossetie commented 9 months ago

No all good 👍🏻