flobilosaurus / vscode-asciidoc-slides

Visual Studio Code extension to create reveal.js slides via asciidoc
MIT License
26 stars 10 forks source link

CSS is not embedded in inlinehtml. #17

Open matoken opened 4 years ago

matoken commented 4 years ago

Export inlined html files don't have css embedded in them. It seems to be looking at the CSS in absolute path.

$ head -13 ./slidesInlined.html
<!doctype html>
<html lang="en">

<head>
    <meta charset="utf-8">

    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
    <link rel="stylesheet" href="/home/matoken/.vscode-oss/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/reveal.js/css/reset.css">
    <link rel="stylesheet" href="/home/matoken/.vscode-oss/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/reveal.js/css/reveal.css">
    <link rel="stylesheet" href="/home/matoken/.vscode-oss/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/league-gothic-font/webfonts
/stylesheet.css">
    <link rel="stylesheet" href="/home/matoken/.vscode-oss/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/reveal.js/css/theme/simple.
css">
    <link rel="stylesheet" href="/home/matoken/.vscode-oss/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/font-awesome/css/font-aweso
me.min.css">
    <link rel="stylesheet" href="/home/matoken/.vscode-oss/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/highlight.js/styles/monokai
.css">

The image is embedded correctly.

<img alt="kagolug" src="data:im
age/png;base64,iVBORw0KGgoAAAAN...

My environment is Linux(Debian sid amd64), so this may be a Linux-specific problem.

i use codium 1.44.2 and AsciiDoc Slides 1.2.0.

sesceu commented 4 years ago

+1 same issue here. I love the slides, but unfortunately, no-one else can look at them if I ship them. This kind of makes the inlinehtml feature useless.

On my generated slides, there is actually some additional inline style information (just below of the excerpt from @matoken). So apparently, there is some mechanism in place to inline CSS.

sesceu commented 4 years ago

Another remark. I guess this is not just about CSS, but also about the reveal.js initialization at the end of the document, i.e.

  <script src="/home/q343319/.vscode/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/highlight.js/lib/highlight.js"></script>
  <script src="/home/q343319/.vscode/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/reveal.js/js/reveal.js"></script>

<script>
    Reveal.initialize({
        hash: true,
        history: true,
        dependencies: [
            { src: '/home/q343319/.vscode/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/reveal.js/plugin/notes/notes.js', async: true } 
        ]
    })
</script>

<script type="text/javascript" src="/home/q343319/.vscode/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/reveal.js/plugin/zoom-js/zoom.js"></script>
<script type="text/javascript" src="/home/q343319/.vscode/extensions/flobilosaurus.vscode-asciidoc-slides-1.2.0/libs/reveal.js/plugin/highlight/highlight.js"></script>

</body>

</html>

Problem seems to be the templates in https://github.com/flobilosaurus/vscode-asciidoc-slides/tree/master/views. There is a placeholder <%= absolutePath %> used pretty regularly. I think rather than adding the files as references, their content should actually be inlined.

flobilosaurus commented 4 years ago

Okay thanks for your feedback. I will look into it later that day...

flobilosaurus commented 4 years ago

@matoken @sesceu Does the new version 1.3.0 solve your problems?

sesceu commented 4 years ago

Just tried the new version. Unfortunately, if I select the option Export slides to inlined Html file I get an error (see below). Calling Export slides to Html file however works, although images are of course not inlined.

Here is the error message:

Error while exporting: The file /home/me/git/slides/home/me/git/slides/foo/image.png was not found!

Seems to be a problem with the way the path for the image to be inlined is constructed. You may see, that /home/me/git/slides actually appears twice in the path.

bentolor commented 1 year ago

This feature doesn't seem to work for me as well. Regarding line count the result appears to be more or less 1:1 of the "regular" vs. "inline" version.

If this features makes problems, I'd recommend to remove it for now.

I'd suggest that it would be more important to be able to create a HTML file which uses relative paths only, so that someone can create at least some sort of portable presentation result using this plugin.

For now all exports will only work on a specific pc.