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

Conditional env for vscode in asciidoc: how to detect we are in vscode preview #280

Closed
prudhomm opened this issue Mar 21, 2020 · 6 comments
Labels
💬 discussion Disccussion on new features, projects, etc... ✨ enhancement

Comments

@prudhomm
Copy link

prudhomm commented Mar 21, 2020

I am writing pages in asciidoc for an Antora website.

I wish to visualise the images in preview. The images are not in the same directory as the adoc file

Is your feature request related to a problem? Please describe

How do I detect that I am in vscode (preview) to display images ?

:imageprefix: 
ifdef::env-github,env-browser[:imageprefix: ../../assets/images/]

work fine at top of doc in github.

Describe the solution you'd like

would it be possible to have something like

:imageprefix: 
ifdef::env-github,env-browser,env-vscode[:imageprefix: ../../assets/images/]

or maybe there exists already an env- that catches that we are in vscode preview?
I would have expected env-browser to work.

@prudhomm prudhomm added 💬 discussion Disccussion on new features, projects, etc... ✨ enhancement labels Mar 21, 2020
@prudhomm prudhomm changed the title How to detect that w Conditional env for vscode in asciiddoc: how to detect we are in vscode preview Mar 21, 2020
@prudhomm prudhomm changed the title Conditional env for vscode in asciiddoc: how to detect we are in vscode preview Conditional env for vscode in asciidoc: how to detect we are in vscode preview Mar 21, 2020
@prudhomm
Copy link
Author

here is an example of an adoc file in an antora framework:
I can see the images in github
https://github.com/feelpp/toolbox/tree/master/examples/modules/cfd/pages/laminar_isothermal_backward_facing_step
as well as in the browser thanks to the asciidoctor.js browser extension
https://raw.githubusercontent.com/feelpp/toolbox/master/examples/modules/cfd/pages/laminar_isothermal_backward_facing_step/README.adoc

@danyill
Copy link
Contributor

danyill commented Mar 24, 2020

Thanks for logging this issue @prudhomm, I think we could set an attribute in vscode to detect this -- something like env-vscode or similar. Happy to take a PR, although I hope to deal with some of these easier issues quite soon.

joaompinto added a commit that referenced this issue Mar 29, 2020
Add env-vscode attribute to detect vs code environment, closes #280
@prudhomm
Copy link
Author

@joaompinto @danyill thanks a lot! any ETR for this feature?

@joaompinto
Copy link
Contributor

@prudhomm 2.7.15 was published now, containing this improvement.

Thanks

@prudhomm
Copy link
Author

Thanks a lot

@prudhomm
Copy link
Author

@danyill @joaompinto it works very well.
for the record, here is what +I did:

top of the document, / at the end

ifdef::env-github,env-browser,env-vscode[:imagesprefix: ../../images/]

where I add an image, no / at the end

image::{imagesprefix}myimage.png[]

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

3 participants