Dear All,
I have been using BJ's wonderful Visual Editor Plugin (
http://bjtools.tiddlyspot.com/#VisualEditor) to put down my notes in a WYSIWYG manner and I finally managed to get things work to my liking except for the appearance of the code snippets.
My aim is to get a form of syntax highlighting in the resulting tiddler similar to the way done by highlight.js plugin in TW5 but using the CKEditor. I am using a custom build of CKeditor with the codesnippet add-on and also have thehighlight.js plugin installed on TW5 (5.1.13). Unfortunately I couldn't get it to work so far. I wonder whether anyone has tackled with this problem before or has suggestions on the direction to proceed.
I attached two screenshots, one with ckeditor 'editor view' and one with the rendered view of the resulting tiddler. Here are my observations:
1. Using ckeditor's codesnippet add-on: Syntax highlighting works in edit view, but doesn't show up in the resulting tiddler.
2. Code snippet with Wikitext markup and TW5 highlight.js plugin: The result is verbatim text with some html markup.
Here is the html source generated by case 1 i.e. using ckeditor and its codesnippet add-on:
<pre class="python hljs"><code><span class="hljs-keyword">import</span> base64
<span class="hljs-keyword">with</span> open(<span class="hljs-string">"t.png"</span>, <span class="hljs-string">"rb"</span>) <span class="hljs-keyword">as</span> imageFile:
str = base64.b64encode(imageFile.read())
<span class="hljs-keyword">print</span> str</code></pre>
in comparison to what is generated using TW5 highlight.js plugin (in a separate tiddler where syntax highlighting works):
<pre><code class="language-python">import base64
with open("t.png", "rb") as imageFile:
str = base64.b64encode(imageFile.read())
print str</code></pre>
I am very new to html and js but those look quite different to me. Is there a way to reconcile the way CKEditor does syntax highlighting with the 'default' way TW5 does using the highlight.js plugin?
I need to add that I have only found out about Tiddlywiki a few months ago but it has revolutionized the way I take and organize my notes! Plus the wonderful community that is active, creative and always willing to help.
Thank you!
Altug