asciidoctor-vscode icon indicating copy to clipboard operation
asciidoctor-vscode copied to clipboard

Relative path "Asciidoc > Preview: Style" doesn't work. Work only full path to css file.

Open marcindrabik opened this issue 3 years ago • 9 comments

Relative path Ascidoc > Preview: Style doesn't work. Work only full path to css file.

marcindrabik avatar Aug 17 '21 17:08 marcindrabik

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.

image

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.

danyill avatar Aug 21 '21 04:08 danyill

On my machine (Windows 10) it doesn't work. But i have solution. Attributes works properly: :stylesdir: mystylesheets :stylesheet: mystyles.css

marcindrabik avatar Aug 23 '21 07:08 marcindrabik

On Windows, it seems, the value of ${workspaceFolder} is resolved incorrectly. It is always prepended with slash ('/').
image

gsergya avatar Feb 21 '22 00:02 gsergya

@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.

ggrossetie avatar Feb 21 '22 18:02 ggrossetie

@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!

ggrossetie avatar Feb 21 '22 18:02 ggrossetie

I can confirm the issue on Windows (Windows 11, vscode 1.64.2, asciidoctor 2.9.5 ) image 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.
image 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. image image I've tried to use ${workspaceFolder} to point to the styles directory relative to workspace root. image 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" image

gsergya avatar Feb 22 '22 11:02 gsergya

@gsergya Thanks for the detailed examples 👍🏻

ggrossetie avatar Feb 22 '22 19:02 ggrossetie

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.

OkkeHendriks avatar Sep 01 '22 09:09 OkkeHendriks

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

a-bronx avatar Mar 25 '23 02:03 a-bronx