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

add imagesdir setting in asciidoctor attributes when antora is enable #855

Open
man-chi opened this issue Mar 16, 2024 · 7 comments
Open
Labels
💬 discussion Disccussion on new features, projects, etc... ✨ enhancement

Comments

@man-chi
Copy link

man-chi commented Mar 16, 2024

problem: many users of asciidoctor would like to use antora as HTML site generation. however, the default image directory structure will be /docs/ROOT/module/images while the *.adoc are stored in /docs/ROOT/module/pages.
due to the vscode webpreview permission setting, web preview is unable to display any image::diagram.jpg[my diagram]

proposed solution:
as a workaround before Antora is fully supported, I managed to preview images in vscode-asciidoctor web preview by doing the following setting in vscode web preview:
• vscode-asciidoc extension > settings > asciidoc >preview : asciidoctor attributes
• Edit in settings.json
"asciidoc.preview.asciidoctorAttributes": {
"imagesdir":"../images/"
}

I want to suggest presetting the settings.json
"asciidoc.preview.asciidoctorAttributes": {
"imagesdir":"../images/"
}
when the Antora checkbox is enabled in the extension setting

@ggrossetie
Copy link
Member

It should already work if you enable Antora support. Here's an example:

Capture d’écran 2024-03-16 à 11 46 31

@man-chi
Copy link
Author

man-chi commented Mar 16, 2024

it is odd. the image does not preview by default. unless add the following imagesdir entry in settings.json
"asciidoc.preview.asciidoctorAttributes": {
"imagesdir":"../images/"
}

@ggrossetie is your vscode a specific version? nightly build? anything we need to do?
I am running vscode Version: 1.87.2
vscode-asciidoc extension v3.2.0

@ggrossetie
Copy link
Member

Do you have "asciidoc.antora.enableAntoraSupport": true in your settings? Did you get a popup asking you to enable Antora support?
Do you have an antora.yml file with a name and version? Do you have a valid Antora structure?

I'm using version 3.2.0 of the extension:

Version : 1.86.0 (Universal)
Validation : 05047486b6df5eb8d44b2ecd70ea3bdf775fd937
Date : 2024-01-31T10:29:15.765Z
Electron : 27.2.3
ElectronBuildId : 26495564
Chromium : 118.0.5993.159
Node.js : 18.17.1
V8 : 11.8.172.18-electron.0
Système d’exploitation : Darwin arm64 23.2.0

@man-chi
Copy link
Author

man-chi commented Mar 16, 2024

yes, in my Code/user/settings.json, I do have

"asciidoc.antora.enableAntoraSupport": true,

Did you get a popup asking you to enable Antora support?
I recalled that there was a dialog box showed up before but I did not manage to click yes. afterward, I do not have any opportunity to see the option again. how can I see the popup again?

I do the antora.yml file and I have been using antora site generation successfully for the past few months.
the structure is the standard of antora, such as
Screen Shot 2024-03-17 at 12 36 16 AM

antora.yml

title: Main
name: main
version: ~
nav:
  - modules/ROOT/nav.adoc
asciidoc:
  attributes:
    page-pagination: ''
    experimental: ''
    idprefix: ''
    idseparator: '-'

@ggrossetie
Copy link
Member

@man-chi We save this setting in the workspace state but as far as I know there's no easy way to reset this state. You will need to delete files from your disk:

<user-data-dir>\User\globalStorage\state.vscdb
<user-data-dir>\User\workspaceStorage\<workspace.id>\state.vscdb

Depending on how VS Code was launched you could have a Single Folder Workspace or a Multi-Folder Workspace that is global or local. Globally, the data lives here:

Linux: $HOME/.config/Code/
OS X: $HOME/Library/Application Support/Code/
Windows: %APPDATA%\Code\

If you reset the workspace state and open nav.adoc the popup should show again. I think we need to add an action to activate/deactivate Antora on a workspace.

The setting "asciidoc.antora.enableAntoraSupport": true is here to enable Antora but then you need to activate Antora per workspace.

@ggrossetie
Copy link
Member

I think I will do the following to make it easier to activate/deactivate Antora.

  • Replace the current user/workspace setting by "Show a prompt to enable Antora support when an antora.yml file is detected". yes/no
  • Add a command to toggle Antora support on a given workspace (saved in Memento)

That way you can control if you want a prompt when the extension detects an antora.yml file. And you also have the ability to enable/disable Antora support using a command (in case you clicked "no" on the prompt or in case the extension didn't detect the antora.yml or in case you want to turn it off)

@man-chi What do you think?

@man-chi
Copy link
Author

man-chi commented Mar 27, 2024

yes, it sounds awesome. thanks for making such improvement. I love antora.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💬 discussion Disccussion on new features, projects, etc... ✨ enhancement
Projects
None yet
Development

No branches or pull requests

2 participants