Hi Hugo,

I have written some notes about adding syntax coloring for the C language. 
Thanks to these you should be able to do the same for tiddlywiki type 
tiddlers.
I'm sorry it's not exactly what you are looking for but I can't answer you 
more precisely for now. 

Here you go:


Adding syntax colouring for C
Add this tiddler for codemirror 
$:/plugins/tiddlywiki/codemirror/mode/clike/clike.js with this code : 
https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/clike/clike.js


*Configuration:*

{
  "require": [
      "$:/plugins/tiddlywiki/codemirror/mode/javascript/javascript.js",
      "$:/plugins/tiddlywiki/codemirror/mode/clike/clike.js",
      "$:/plugins/tiddlywiki/codemirror/mode/xml/xml.js",
      "$:/plugins/tiddlywiki/codemirror/addon/dialog/dialog.js",
      "$:/plugins/tiddlywiki/codemirror/addon/search/searchcursor.js",
      "$:/plugins/tiddlywiki/codemirror/addon/fold/foldcode.js",
      "$:/plugins/tiddlywiki/codemirror/addon/fold/xml-fold.js",
      "$:/plugins/tiddlywiki/codemirror/addon/fold/foldgutter.js",
      "$:/plugins/tiddlywiki/codemirror/addon/fold/brace-fold.js",
      "$:/plugins/tiddlywiki/codemirror/addon/fold/comment-fold.js",
      "$:/plugins/tiddlywiki/codemirror/addon/fold/indent-fold.js"
  ],
  "configuration": {
      "showCursorWhenSelecting": true,
      "matchTags": {"bothTags": true},
      "foldGutter": true,
      "gutters": ["CodeMirror-linenumbers", "CodeMirror-foldgutter"]
  }
}






   1. Find the matching MIME type. If you go on the CodeMirror 
   documentation for language modes <http://codemirror.net/mode/index.html> 
   you can see the documentation for the c-like mode 
   <http://codemirror.net/mode/clike/index.html>. In this documentation, at 
   the end you will be told the MIME types defined. Here it's *text/x-csrc*.
   2. Add the matching EditorTypeMappings 
   <http://wiki.erwandano.com/#EditorTypeMappings>. Add the tiddler : 
   $:/config/EditorTypeMappings/text/x-csrc and fill the text field with : 
   *codemirror*.
   3. Reload the page
   4. Edit a tiddler with the type : *text/x-csrc*

*Consequences:*
You should see your code being coloured.


For your particular use Hugo, you should use this code 
https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/tiddlywiki/tiddlywiki.js
 
instead of the clike/clike.js I gave. 
And you should also add a css sheet (a tiddler with the tag 
*$:/tags/Stylesheet* containing the css code) with this code : 
https://raw.githubusercontent.com/codemirror/CodeMirror/master/mode/tiddlywiki/tiddlywiki.css

I haven tested it with the tiddlywiki mode though.

Hope this helps

Erwan


On Monday, November 10, 2014 10:24:11 AM UTC, Hugo Disanv wrote:
>
> Hello,
> Do you know how to add syntax coloring for tiddlywiki type tiddlers ?
> Thanks. 
>
> Le lundi 29 septembre 2014 19:43:30 UTC+2, Stephen Kimmel a écrit :
>>
>> Among the tiddlytools I've used the most were the Quick Editor tools. 
>> I've been looking at standins until such time as tiddlytools is updated for 
>> TW5. Among the items I've looked at is the Codemirror plugin. 
>> http://tiddlywiki.com/plugins/tiddlywiki/codemirror/ Following the link 
>> http://codemirror.net/ it looks like it ought to be able to do a good 
>> deal more like search and replace. You couldn't prove that by my 
>> experience. As close as I can tell, it adds line numbers. 
>>
>> The Tiddlywiki documentation for this plugin boils down to "Try editing 
>> the tiddler LoremIpsum 
>> <http://tiddlywiki.com/plugins/tiddlywiki/codemirror/#LoremIpsum> to try 
>> out the editor." Given that the visually obvious difference from the 
>> Tiddlywiki editor is minimal, this isn't helpful. The Codemirror site's 
>> documentation appears to be written in English but once you get past the 
>> opening page strikes me as being almost incomprehensible. 
>>
>> Is there someone out there who is using the Tiddlywiki CodeMirror Plugin 
>> on Firefox in a Windows environment who can tell me if this plugin actually 
>> does anything helpful? If this plug-in is really just for Linux systems, 
>> then could we update the documentation to say as much?
>>
>> I've watched the group here for some time and there seems to be a generic 
>> issue here. I hope I don't offend anyone but a lot of the Tiddlywiki 
>> documentation seems to be written by insiders for insiders. I'm sure 
>> Danielo and Eric and many of the others understand what is being said but 
>> there seem to be far to many people who are mystified by it. And I'll wager 
>> that most would be users never get far enough to even find this group. As 
>> an experiment, try handing a copy of Tiddlywiki to your mother (or someone 
>> else you wouldn't describe as a "power user") and see how long they last. 
>> The documentation should be pitched at their level. 
>>
>> Stephen
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/tiddlywiki.
For more options, visit https://groups.google.com/d/optout.

Reply via email to