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

Expose MarkdownEngine.currentDocument to contributed extensions #84846

Closed
yhatt opened this issue Nov 14, 2019 · 5 comments
Closed

Expose MarkdownEngine.currentDocument to contributed extensions #84846

yhatt opened this issue Nov 14, 2019 · 5 comments
Assignees
Labels
api feature-request Request for new features or functionality markdown Markdown support issues

Comments

@yhatt
Copy link
Contributor

yhatt commented Nov 14, 2019

VS Code's Markdown engine has stored the URI of document under parsing but it's not exposed to Markdown preview extensions (markdown-it plugins).

Exposing the location of current document (MarkdownEngine.currentDocument) to the second argument of markdown-it functions (env object) would like to be good for contributed extensions. Please let me hear if there is any concern.

Motivation

My extension, marp-team.marp-vscode, has implemented the support of CSS themeing that is separated from markdown.styles built-in preference. I have used a hacky way (execute md.normalizeLink() directly) to get the placed directory of Markdown under parsing. I need it for matching the rule of CSS path resolution into markdown.styles.

https://github.com/marp-team/marp-vscode/blob/a3dc7bd8d50e97b995a2c7b57f38479cf1696334/src/extension.ts#L30-L32

Until VS Code 1.39.x, that was expected to get URI to the workspace folder Markdown belongs, or the directory that Markdown is placed.

Unfortunately this is no longer working since 1.40.0 by the change in 36aa903 (reported in marp-team/marp-vscode#100). I tried to fix this but failured because I could not find the correct way to get current document while parsing.

I have recognized the design of markdown.styles to avoid reading arbitrary files (#75039), and I'm sure following this principle should be better to make extension secure.

@vscodebot
Copy link

vscodebot bot commented Jan 23, 2020

This feature request is now a candidate for our backlog. The community has 60 days to upvote the issue. If it receives 20 upvotes we will move it to our backlog. If not, we will close it. To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodebot
Copy link

vscodebot bot commented Mar 13, 2020

This feature request has not yet received the 20 community upvotes it takes to make to our backlog. 10 days to go. To learn more about how we handle feature requests, please see our documentation.

Happy Coding

@vscodebot
Copy link

vscodebot bot commented Mar 23, 2020

🙁 In the last 60 days, this feature request has received less than 20 community upvotes and we closed it. Still a big Thank You to you for taking the time to create this issue! To learn more about how we handle feature requests, please see our documentation.

Happy Coding!

@vscodebot vscodebot bot closed this as completed Mar 23, 2020
@christianvoigt
Copy link

I know I am too late for this feature request, but I think this is comparatively easy to fix and would improve the configurability of markdown-it plugins a lot.

I am currently adding a markdown-it plugin to the Argdown VSCode extension and want to load configuration files specific to the workspace of the currently previewed document. As I do not want to use a "messy workaround" as in the marp plugin, I think I have to give up on this.

@yhatt
Copy link
Contributor Author

yhatt commented Apr 23, 2020

@christianvoigt Thanks for having same opinion!

The workaround may have misdetection the location of workspace while opening the exactly same 2 Markdowns in different workspaces, so I don't want to use this trick if possible.

Should I open as a new issue to continue this?

@github-actions github-actions bot locked and limited conversation to collaborators May 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api feature-request Request for new features or functionality markdown Markdown support issues
Projects
None yet
Development

No branches or pull requests

3 participants