Fossil Forum

Skinning Experience
Login

Skinning Experience

Skinning Experience

(1) By simplejack on 2022-03-27 22:41:31 [link] [source]

Hello,

I ran off a new skin (here for reference), and have to say the experience (following the recommended --skin method) was pretty slick. Well as slick as it can be working with web frameworks (props to anyone who has to work with the mish-mash known as the WWW on a daily basis).

One sticking point though. I added highlight.js for code highlighting to my skin and while I was able to embed the required CSS file in my skin CSS, I was unfortunately unable to do the same with the JS. This came down to having to call the TH1 styleScript command in either the header or footer. The entire JS file then gets run through the TH1 interpreter which (among other things) causes $variablename expansions to take place (which either incorrectly succeed or fail miserably as $ is used for a different purpose in JS).

On the whole though, a pretty pleasant experience. So I'd like to extend a well-earned Thank-you to the great work done by the Fossil developers.

(2) By Stephan Beal (stephan) on 2022-03-28 01:18:59 in reply to 1 [link] [source]

One sticking point though. I added highlight.js for code highlighting to my skin and while I was able to embed the required CSS file in my skin CSS, I was unfortunately unable to do the same with the JS.

There's an example of loading highlightjs, without the problem you describe, at:

https://fossil.wanderinghorse.net/r/cwal/dir?ci=tip&name=doc/highlightjs

(3) By simplejack on 2022-03-28 17:15:12 in reply to 2 [link] [source]

Hi Stephan,

The article you linked describes different ways of adding the highlight.min.js file to the repository (and how to access it). Which I consider fine as a workaround (I currently add it as an unversioned file and access it via /uv), however, as I consider code highlighting an aspect of the projects skin it would be more appropriate to have it embedded in the skins JS file (a simple separation of concerns).

I suppose, I could (and may at some point) go through the highlight.js file and manually (or write a script) to substitute/escape TCL special characters (or insert { } around all aspects). Although, I do pity someone trying to pull this off with a jQuery script (so many dollar signs...).

(4) By PF (peter) on 2022-03-28 19:11:43 in reply to 3 [link] [source]

In my very lo-fi solution, which works great for my purposes of highlighting, I just embed prism.js into footer.txt (and relevant css in css.txt).

I ended up with this approach after much to many attempts to outsmart TH1 interpretation of javascript file loaded by <th1>styleScript</th1> method.

I want to have my custom build fossil with additional custom skin embedded in executable. This way I need no trickery with repository and /uv files to load. I just use my fossil binary and choose my custom skin to highlight source files.

<script nonce="$nonce">
/* PrismJS 1.27.0 https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+ ... +yaml */
//HERE min prism.js code
</script>

(5) By simplejack on 2022-03-29 02:21:56 in reply to 4 [source]

If your going the full route of compiling your own custom binary you could use the TH1 function builtin_request_js to have PrismJS loaded verbatim (without additional TH1 processing).

I'm primarily looking to have it embedded in the JS section of the skin to be proper (without having to have an additional separate file exist somewhere in the repository). I also wanted a local copy (no MDN reference) to keep it functional in the offline DVCS case.

Perhaps I could propose a feature request to have js.txt be handled in the same manner as css.txt? Which would then be loaded at an appropriate place in the generated HTML (footer area) and not be subject to TH1 handling?

Alternatively, perhaps variable expansion could be limited to within <th1></th1> blocks?