Beginner help with html export

Hi, I’m having some trouble getting the html export to work as I expect. I thought the behavior might be a bug with tmhtml.scm, but now I suspect I’m just not setting things up correctly.

I have a number of .tm files that use a style file modeled after Massimiliano Gubinelli’s homepage style file, see https://github.com/mgubi/mgubi.github.io. In particular, I borrowed his resources/ folder which contains css and javascript snippets. These are linked to in the style file via:

<assign|html-css|/resources/notes-base.css>
<assign|html-extra-javascript-src|<tuple|/resources/highlight.pack.js|/resources/notes-base.js>>

The problem is: when I export my page to html, it comes out completely unformatted (rather than what I would expect, a css-formatted webpage). Additionally, all the links are not preserved.

For reference, this is what my site looks like in the TeXmacs editor (I’d like the final export to be as close to this as possible):

Is there something basic that I’m missing? Also, is there a guide to exporting to html that covers things like integrating css formatting correctly?

Hi @cckisby. I investigated this and I found the answer in another blog post: Environment variables for customized HTML export do not work (I had found this blog post time ago and then forgotten about it :slight_smile: )

Setting the environment variables for html export in a style file (which I put in the personal TeXmacs initialization folder) worked for me. Pls. let me know if it works for you.

3 Likes

Hey, thank you for looking into this!

I had the environment variables set in a style file, but I usually put my style files in the installation folder (for me (on Kubuntu), it’s /home/USERNAME/TeXmacs/). I moved it over to the local directory /home/USERNAME/.TeXmacs/, and it successfully added the header to the html file that indicates where the css and javascript files should be. But it didn’t apply the css.

But it turns out that the environment variable setting
<assign|html-css|/resources/notes-base.css>
points to the root directory rather than local (maybe Windows recognizes this as a local path). After changing these assignments to
<assign|html-css|resources/notes-base.css>
(no initial /), the css is applied as expected :slight_smile:

The links still don’t work, and that top bar didn’t format like I expected. But these are separate issues that I’m able to debug.

In that other thread, when jeroen refers to local style files, does that mean style files located in .TeXmacs, or style files located in the same directory as the current file?

I think @jeroen refes to style files located in .TeXmacs ; I have “mentioned” him so that if he wants he can answer himself. I did not test on Windows—bug https://savannah.gnu.org/bugs/?61563 has status fixed so it might work now.

I think the CSS should apply from any style file, either in the same directory as the .tm file, or in the TeXmacs home directory styles subdirectory. The system styles directory should also work. It doesn’t work from the header for some reason, though.

The report for this behaviour is here:
https://savannah.gnu.org/bugs/?func=detailitem&item_id=60431