1
0
mirror of https://github.com/Jermolene/TiddlyWiki5 synced 2025-08-31 01:48:02 +00:00

Clean up the highlight plugin

Fixing various issues that were preventing language specifiers from
working.
This commit is contained in:
Jermolene
2014-02-10 13:51:38 +00:00
parent e003889171
commit ecba4f71ea
4 changed files with 32 additions and 50 deletions

View File

@@ -1,13 +1,19 @@
title: HelloThere
This is a demo of TiddlyWiki5 incorporating a plugin for the [[highlight.js|https://github.com/isagalaev/highlight.js]] Syntax highlighting for the Web from Ivan Sagalaev.
This is a demo of TiddlyWiki5 incorporating a plugin for the [[highlight.js|https://github.com/isagalaev/highlight.js]] syntax highlighting library from Ivan Sagalaev.
The HighlightExample tiddler have fenced blocks of code.
! Usage
To add the plugin to your own TiddlyWiki5, just drag this link to the browser window:
The HighlightExample tiddler shows how fenced code blocks can have a language specifier added to trigger highlighting.
! Installation
To add this plugin to your own TiddlyWiki5, just drag this link to the browser window:
[[$:/plugins/tiddlywiki/highlight]]
To add your prefered [[theme|http://highlightjs.org/static/test.html]] append to your:
! Adding Themes
[[$:/tags/stylesheet]]
You can add themes from highlight.js by copying the CSS to a new tiddler and tagging it with [[$:/tags/stylesheet]]. The available themes can be found on GitHub:
https://github.com/isagalaev/highlight.js/tree/master/src/styles

View File

@@ -1,6 +1,6 @@
title: HighlightExample
''Javascript'' fenced code:
''Javascript'' code:
```javascript
(function(a,b){
@@ -9,7 +9,7 @@ title: HighlightExample
})(10,20)
```
''CSS'' fenced code:
''CSS'' code:
```css
* { margin: 0; padding: 0; } /* micro reset */
@@ -19,7 +19,7 @@ body { font-size: 14px; font-size: 1.4rem; } /* =14px */
h1 { font-size: 24px; font-size: 2.4rem; } /* =24px */
```
''Perl'' fenced code:
''Perl'' code:
```perl
package Name;
@@ -39,9 +39,9 @@ sub new {
}
```
''Python'' fenced code:
''Python'' code:
```
```python
class Singleton:
__single = None
def __init__( self ):
@@ -49,9 +49,3 @@ class Singleton:
raise Singleton.__single
Singleton.__single = self
```
''~No-Highlight'' now
```no-highlight
$ TW5_BUILD_OUTPUT=tmp/ ./bld.sh
```