asciidoctor-vscode
asciidoctor-vscode copied to clipboard
Relative path "Asciidoc > Preview: Style" doesn't work. Work only full path to css file.
Relative path Ascidoc > Preview: Style doesn't work. Work only full path to css file.
Thanks for logging an issue.
With a folder open, the relative path appears to work correctly on my machine with the latest version of this extension where the css file is in the base of the open folder (extension setting: test_style.css
). It also seemed to work correctly for a subfolder for me (extension setting: b/test_style.css
.
As you point out, absolute paths appear to work correctly and are one workaround.
Could you describe the use case which is not working for you in more detail please. Which platform are you on? I typically use Linux and it may be related to the OS.
On my machine (Windows 10) it doesn't work. But i have solution. Attributes works properly: :stylesdir: mystylesheets :stylesheet: mystyles.css
On Windows, it seems, the value of ${workspaceFolder} is resolved incorrectly. It is always prepended with slash ('/').
@gsergya I don't get your comment, ${workspaceFolder}
is a predefined variable: https://code.visualstudio.com/docs/editor/variables-reference
You should open an issue at https://github.com/microsoft/vscode if you think the value if incorrect on Windows.
@marcindrabik Unless you can provide a detailed reproduction case, I will be compelled to close this issue as there's simply not enough information to fix issue. Thanks!
I can confirm the issue on Windows (Windows 11, vscode 1.64.2, asciidoctor 2.9.5 )
In order to understand what is going wrong I've replaced "asciidoctor" default command with "echo". In this case, seems, we can see command line used by extension to render output html.
In the output we can find unexpected slash ('\') prepending full path to workspace root in stylesdir attribute. The only way I can get it working is using custom attributes.
I've tried to use ${workspaceFolder} to point to the styles directory relative to workspace root.
But seems again the value is prepended with unexpected slash ('/'). This pointed me to the idea that something went wrong while processing ${workspaceFolder} variable.
At the same time ${workspaceFolder} is processed as expected with "Tasks"
@gsergya Thanks for the detailed examples 👍🏻
I am having the same issue, the ${workspaceFolder}
variable is prefixed with a slash. This is probably not a problem on linux, but on windows it is.
Same issue, the custom CSS file cannot be loaded, and the editor shows an error squiggle line with the following tooltip message:
<stdin>: stylesheet does not exist or cannot be read: /C:/<path to the repo>/docs/common/style.css -- asciidoctor.js
My settings.json
for the workspace:
{
"asciidoc.preview.useEditorStyle": false,
"asciidoc.preview.style": "docs/common/style.css"
}
Probably the root cause is similar to this. As you can see, I don't use the ${workspaceFolder}
in my config, but still get a path with an extra /
prefix.
- VSCode for Windows v1.76.2
- AsciiDoc for VSCode v2.9.8