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

Allow configuring a base uri for MarkdownString #142051

Closed
mjbvz opened this issue Feb 3, 2022 · 3 comments
Closed

Allow configuring a base uri for MarkdownString #142051

mjbvz opened this issue Feb 3, 2022 · 3 comments
Assignees
Labels
api api-finalization insiders-released Patch has been released in VS Code Insiders
Milestone

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Feb 3, 2022

Feature request

Allow configuring a base uri that is used when rendering the contents of a MarkdownString. This uri would be used when resolving relative paths that appear as links or image links within the markdown string

Example use case

const md = new vscode.MarkdownString(`
[link](toSiblingFile.md)

![img](./image/from/dir.gif)
`);

md.baseUri = vscode.window.activeTextEditor.document.uri

When rendered, link and img should both resolve to files next to the currently active file

Related issues

@mjbvz
Copy link
Collaborator Author

mjbvz commented Feb 3, 2022

The alternative today is that extensions have to parse the markdown and transform the uris themselves. This is difficult to get correct

@DanTup
Copy link
Contributor

DanTup commented Apr 11, 2022

@dbaeumer is this something that should be in the LSP spec (for servers to set), or the client (assuming they should be relative to the document the request relates to)?

@dbaeumer
Copy link
Member

@DanTup I think we should do the following:

  • spec that a markdown string in a response can have relative links based on the requesting document
  • set the base in the VS Code lsp client.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api api-finalization insiders-released Patch has been released in VS Code Insiders
Projects
None yet
Development

No branches or pull requests

4 participants
@DanTup @dbaeumer @mjbvz and others