vscode-ghc-simple
vscode-ghc-simple copied to clipboard
Images in documentation are not displayed correctly
Status
- [x] A workaround is available
- [ ] A fix is written
- [ ] A fix is released
- [ ] The fixed version is on the marketplace.
- Version of vscode-ghc-simple: 0.2.2
- Version of VSCode: 1.49.3
- Version of Haskell-related tools:
- GHC: 8.8.2
- Stack: 2.5.1
- Cabal: 1.12
Steps to reproduce
-
Create a stack project
-
Add documentation to an expression with a link to an image as documentation according to haddock's docs: https://haskell-haddock.readthedocs.io/en/latest/markup.html?highlight=image#images
-
Hover over a documented expression
- I expect an image to be displayed the same way as it's displayed in the haddock generated html, instead I see a broken link:
Workspace
I have an example repo here that can be used for that: https://github.com/JuanFdS/ghc-simple-images-in-docs
GHC log
-> :m *Lib
ghci |
ghci | ===ghci_barrier_0.3134433367884164===
-> :doc someFunc
ghci | someFunc
ghci |
ghci | 
ghci |
ghci | ===ghci_barrier_0.20165484847247228===
Some more info
I think the issue is happening because of this transformation: https://github.com/dramforever/vscode-ghc-simple/blob/a5497ecff4fc831b4812459168675c8f9e5ae893/src/utils.ts#L112-L113
The /
in the image url are being replaced by _
.
Workaround
I realised that by escaping the urls placing a \ before each / it works fine and that also works fine in haddock and https://github.com/haskell/vscode-haskell. For example, changing:
-- | 
to
-- | 