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

Fix Custom CSS URL Possible Double Slash #60

Merged
merged 3 commits into from
Feb 29, 2024
Merged
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
13 changes: 10 additions & 3 deletions packages/application/src/plugins/rise.ts
Original file line number Diff line number Diff line change
Expand Up @@ -924,19 +924,26 @@
// https://github.com/jupyterlab-contrib/rise/issues/509
// Attempt to load rise.css
const curdir = PathExt.dirname(panel.sessionContext.path);
const riseCssUrl = new URL(
PathExt.join('files', curdir, 'rise.css'),
PageConfig.getBaseUrl()
);
document.head.insertAdjacentHTML(
'beforeend',
`<link rel="stylesheet" href="${PageConfig.getBaseUrl()}files/${curdir}/rise.css" id="rise-custom-css" />`
`<link rel="stylesheet" href="${riseCssUrl.href}" id="rise-custom-css" />`
);
const name = PathExt.basename(panel.sessionContext.path);
const dot_index = name.lastIndexOf('.');
const stem = dot_index === -1 ? name : name.substr(0, dot_index);
// associated css
const name_css = `${curdir}/${stem}.css`;
const nameCssUrl = new URL(
PathExt.join('files', curdir, `${stem}.css`),
PageConfig.getBaseUrl()
);
// Attempt to load css with the same path as notebook
document.head.insertAdjacentHTML(
'beforeend',
`<link rel="stylesheet" href="${PageConfig.getBaseUrl()}files/${name_css}" id="rise-notebook-css" />`
`<link rel="stylesheet" href="${nameCssUrl.href}" id="rise-notebook-css" />`
);

// Asynchronously import reveal
Expand Down Expand Up @@ -1281,7 +1288,7 @@
}

// @ts-expect-error 'Private' may never be read
namespace Private {

Check warning on line 1291 in packages/application/src/plugins/rise.ts

View workflow job for this annotation

GitHub Actions / build

'Private' is defined but never used
export function setupLog(): void {
const _debug = console.debug;
const _info = console.info;
Expand Down
Loading