README.md 3 KB
Newer Older
Alex Pearce's avatar
Alex Pearce committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
TWiki styling
=============

Styles for making a TWiki cleaner, prettier, and more readable.

![Example pages styled with the CSS in this repository.](preview.png)

This repository contains a CSS file which can be uploaded to your TWiki user 
page, which you can then tell TWiki to use.

There is also an optional JavaScript file, which will replace the default
LaTeX-rendered-as-images with LaTeX rendered by [KaTeX][katex].

Style Installation instructions
-------------------------------

TWiki allows each user to define preferences on their personal user page. My 
user page, as an example, is at:

```
https://twiki.cern.ch/twiki/bin/view/Main/AlexPearce
```

There is one set of preferences that allows the user to define a URL to a CSS 
file, which is then used to style the site.

To ‘install’ the CSS style in this repository, download the file to your 
machine, and then upload it to your TWiki user page.
Find the URL TWiki gives it, then edit your user page in the ‘raw edit’ mode 
and add this fragment:

```
   * Set USERSTYLEURL = %PUBURLPATH%/Main/AlexPearce/twiki.css
```

The preceding spaces are important. TWiki requires the preferences to be 
defined in a unordered list, and in TWiki markup these are denoted with three 
spaces followed by an asterisk `*`.

`%PUBURLPATH%` is a variable that is expanded by TWiki. For me, it expands to 
the value ` /twiki/pub`, which happens to be the prefix of the CSS file’s 
upload path.

Alex Pearce's avatar
Alex Pearce committed
44
45
46
47
48
49
50
51
52
53
### Fonts

Right now, the stylesheet assumes you have ‘Source’ family of fonts from Adobe 
installed. These are good-looking, freely available, open source fonts 
available to download on Github:

* [Source Serif Pro][source-serif]
* [Source Sans Pro][source-sans]
* [Source Code Pro][source-code]

Alex Pearce's avatar
Alex Pearce committed
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
JavaScript Installation instructions
------------------------------------

There are many ways of injecting custom JavaScript into a web page. I use 
[Tampermonkey][tampermonkey].

To install the TWiki LaTeX prettification script, install something like 
Tampermonkey, click on the Tampermonkey button that appears in your browser’s 
toolbar, then click ‘Create a new script…’. Paste in the contents of the 
JavaScript file from this repository, and click the ‘Save’ in the Tampermonkey 
editor interface.

When you next visit a page whose URL matches the script’s matching rule 
(currently `https://twiki.cern.ch/*`), the script will be loaded. You can check 
that it’s working by clicking the Tampermonkey toolbar button, and seeing that 
that script is listed as active.

Contributions
-------------

The styling is by no means complete, and contributions are most welcome, just 
open a merge request.
In particular, tables have the default TWiki styling. I don’t find it 
outrageously offensive, but it could be better.

[katex]: https://khan.github.io/KaTeX/
[tampermonkey]: http://tampermonkey.net
Alex Pearce's avatar
Alex Pearce committed
81
82
83
[source-serif]: https://github.com/adobe-fonts/source-serif-pro
[source-sans]: https://github.com/adobe-fonts/source-sans-pro
[source-code]: https://github.com/adobe-fonts/source-code-pro