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

motplotlib fix #142

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ jobs:
- name: Cache Renv packages
uses: r-lib/actions/setup-renv@v2

# - name: Renv snapshot
# run: Rscript -e "renv::snapshot()"

# Python
- name: Set up Python
uses: actions/setup-python@v3
Expand Down
18 changes: 13 additions & 5 deletions compiler/src/mdast/embed-asset-url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,19 @@ export function embedAssetUrl(ctx: Context) {
}

function getPath(url: string, dirname: string, ctx: Context) {
return path.isAbsolute(url) ||
url.startsWith('http') ||
ctx.options.noEmbedAssetUrl
? url
: path.join(dirname, url);
if (ctx.options.noEmbedAssetUrl) {
return url;
}
if (path.isAbsolute(url) || url.startsWith('http')) {
return url;
}
// pythons matplotlib appears to assign plot images a path
// relative to the project root, whereas all other libraries use
// an absolute path.
if (url.startsWith('cache')) {
return path.join(ctx.cacheDir, url.replace('cache', ''));
}
return path.join(dirname, url);
}

function getProps(value: string) {
Expand Down
Loading