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

exported presentation has localhost links #799

Closed
clux opened this issue Feb 3, 2022 · 5 comments
Closed

exported presentation has localhost links #799

clux opened this issue Feb 3, 2022 · 5 comments
Assignees
Milestone

Comments

@clux
Copy link

clux commented Feb 3, 2022

i cannot find a setting that turns this into the correct relative path - thinking that should just work since all the 3rd party resources are included in the export folder.

e.g. export/index.html

<link rel="stylesheet" href="http://localhost:43639/libs/highlight.js/11.3.1/styles/monokai.min.css">

this makes it hard to use with github-pages or similar (although it sometimes works accidentally when you have the reveal server running locally)

@clux
Copy link
Author

clux commented Feb 3, 2022

i have a workaround for iterating and publishing now:

rm -rf docs/
cp export docs -r
sd  "http://localhost:45707" "/$REPO" docs/index.html

i am probably missing something obvious here though :-)
thanks a lot for writing this extension!

@evilz
Copy link
Owner

evilz commented Feb 3, 2022 via email

@lsmith-kc
Copy link

I had the same issue. Now using a cleanup script after export.

#!/bin/sh 
# replaces references to 'localhost' with relative paths 
# to enable serverless presentations locally and on the web 
 
find ./index.html -type f -exec sed -E -i '' 's/http:\/\/localhost:[0-9]+\//.\//g' {} \; 

evilz pushed a commit that referenced this issue Feb 14, 2022
Add back Context
Add disposable class
Fix export issue #799
@gVallverdu
Copy link

I run into the same issue. But there is also something more about data-background-image.

Here are the issues, if I try to explain (I am not very skilled about server ...)

  • I did a presentation in markdown and it displays very well in vscode.
  • If I copy/paste the link and look at the presentation in a browser it is ok, let's say https://localhost:57795
  • Now I try to export the presentation as html file and open the index.html file in the browser. Two different things happen.

First issue

If I shut down vscode or the presentation (the server, https://localhost:57795), on the browser, the presentation does not display correctly. But, as said in the previous comments, if you replace the https://localhost:57795 by "" or the baseurl of you web page. It works again.

Second issue

The second issue is about data-background-image. Let's say you have the following markdown code:

--

## a title

<!-- .slide: data-background="img/image.jpg" -->

--

When you export the presentation as html, the produced html code is the following :

<section data-background="img/image.jpg">
<!-- .slide: data-background="img/image.jpg" -->
<h2>a title</h2>
</section>

Whatever the state of the server in vscode, if you open the presentation from index.html in a browser, the background image is not displayed. Contrary to the previous solution, you have to add the https://localhost:57795 url to make it works (assuming this server/address is still running in vscode). Actually it works (in all case) if you put, as background, a picture from an url but it does not work if you use a local file. That is why it works if you add the https://localhost:57795 address.

@evilz evilz self-assigned this Mar 8, 2022
@evilz evilz added this to the 4.1.2 milestone Mar 8, 2022
@evilz
Copy link
Owner

evilz commented Mar 8, 2022

Release in 4.1.2

@evilz evilz closed this as completed Mar 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants