Skip to content

Import Code Snippets: support external sources #1496

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

Open
jthegedus opened this issue Mar 31, 2019 · 0 comments
Open

Import Code Snippets: support external sources #1496

jthegedus opened this issue Mar 31, 2019 · 0 comments
Labels
topic: markdown Relates to VuePress markdown type: feature request Request to add a new feature

Comments

@jthegedus
Copy link

Feature request

Import Code Snippets support is great, but from what I have seen in the docs and related issues fetching the snippet file from external sources is not supported. It would be great if this could be extended to import code snippets from files within other repos (or if I have missed something update the docs with an example of this).

What problem does this feature solve?

If I have a docs sites at orgname/docs-site-repo and examples at orgname/examples-repo I could then import snippets from my examples repo into the docs-site repo and not need to maintain two sets of the same code.

This would also allow reusing existing code samples.

What does the proposed API look like?

# local files
<<< @/filepath{highlightLines}

# external files
<<< https://url/file.extension{highlightLines}

How should this be implemented in your opinion?

The existing API would need to support the import string starting with https and a Promise return value so it can fetch.

Are you willing to work on this yourself?

I could certainly help, but am unsure where to start given the number of open issues wanting to change this functionality.

related:

additionally

I believe #750 is adding support for code-fencing, which is highly desired 👍

@shigma shigma added type: feature request Request to add a new feature topic: markdown Relates to VuePress markdown labels Apr 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: markdown Relates to VuePress markdown type: feature request Request to add a new feature
Projects
None yet
Development

No branches or pull requests

2 participants