asciidoctor / asciidoctor-vscode

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

[Feature Request] Point asciidoc.preview.asciidoctorAttributes to file which holds attributes #892

Closed bai-yi-bai closed 3 months ago

bai-yi-bai commented 4 months ago

Please provide details about:

ggrossetie commented 3 months ago

This extension supports the Asciidoctor config file feature as described in: https://intellij-asciidoc-plugin.ahus1.de/docs/users-guide/features/advanced/asciidoctorconfig-file.html

I guess that should solve your issue?

We use an include:: statement at the top of every .adoc file. This means that none of our attributes resolve in the preview or local render.

I don't think attributes should be defined in a distributed component. Might be better to define them in the playbook?

I intend to add this generated antoraattributes.json file to the .gitignore, because I don't want users to rely upon it as a permanent source of truth, since there is no facility to keep it in sync with our "shared" repository. Plus, we have a lot of nested attributes-in-attributes, which json isn't compatible with.

The settings.json already contains the Asciidoctor attributes:

{
    "terminal.integrated.defaultProfile.windows": "Git Bash",
    "redhat.telemetry.enabled": true,
    "asciidoc.preview.refreshInterval": 0,
    "asciidoc.preview.scrollEditorWithPreview": false,
    "asciidoc.preview.templates": [],
    "asciidoc.antora.enableAntoraSupport": true,
    "asciidoc.preview.asciidoctorAttributes": {
        "foo": "bar"
    },
}

If you can retrieve all your attributes, it would be better to either generate an .asciidoctorconfig file or generate the settings.json. Please note that the .asciidoctorconfig can contain attribute references.

bai-yi-bai commented 3 months ago

This is excellent! Thank you so much. I've got a thread on the zulipchat about my attribute strategy, but this solves the problem of preview in VSC.