[TW5] Codemirror, Higlightplugin,...? What to use for code note taking?

104 views
Skip to first unread message

Mat

unread,
Oct 16, 2015, 5:58:43 AM10/16/15
to TiddlyWiki
So, the TWaddle guy is finally learning to code. (Yeah... there's a relief for some of you!) Some JS is on the agenda but for now it's heavy focus on C#.

Obviously I use TW for note taking so I guess I'm facing what many others have faced before me: What's the best way to include code snippets interspersed in my TW notes? Merely using backtics is not practical as it prevents other text formatting. On the other side, I don't want e.g CamelCased stuff to autolink in an uncontrolled manner nor that snippets of code interfere with the general use of the TW. Ideally I'd want snips to work as titles too without messing up stuff....

How should I go about this?

Thanks guys!

<:-)

Jed Carty

unread,
Oct 16, 2015, 7:16:01 AM10/16/15
to TiddlyWiki
I don't know of anything we currently have that will both automatically highlight code and still allow wikitext. Being able to click on a function title and open up a tiddler that contains that function and documentation would be very helpful. Maybe that should be your first big coding project for tiddlywiki. :D

As part of that maybe we should try to make something to make some code highlighting for wikitext. Code highlighting in the normal tiddler editor would be very helpful.

Danielo Rodríguez

unread,
Oct 16, 2015, 9:36:45 AM10/16/15
to TiddlyWiki
Sorry Mat,

I don't understand what is wrong with:

```C#
some cool code
```



Some cool notes

Mark S.

unread,
Oct 16, 2015, 10:30:11 AM10/16/15
to tiddl...@googlegroups.com
Er, is there a way to do that? Looks cool to me.

Edit: I see that you're referring to the Highlight plugin. Oddly, I couldn't get it to work with your C# example, though plain C works.

Edit 2: Maybe the syntax code for C# is actually "cs" ?

Thanks!
Mark

Jed Carty

unread,
Oct 16, 2015, 12:40:16 PM10/16/15
to TiddlyWiki
Danielo,

I think that, particularly when learning but even after that, it would be very nice to be able to have a long function that uses many other functions and just be able to click on a function name to open up the code for that function and its documentation. I think it is a matter of 'pretty good' and 'better', not that the current possibilities are bad.

Mat

unread,
Oct 16, 2015, 12:44:21 PM10/16/15
to TiddlyWiki
Jed, thanks for replying! 


I don't know of anything we currently have that will both automatically highlight code and still allow wikitext.

In a way I guess I'm looking for something that merely is a less powerful backtick formatter. Currently, using backticks disables all other formatting. But if you use, say, italic-slashes you can still apply other formatting on top of it. Maybe there could be concise(!) wikitext formatter that would produce the same result as merely surrounding the things with a styled div or span. I.e so that these two would yield the same appearence (I'm winging the CSS a bit but I think the point is clear)

<span style="font-style:Monospace; background:lightgray;">Some //cool// code!</span>

££Some //cool// code!££

The ££ is just an example to illustrate something as concise as the normal wikitext formatters.

By the way... it is a bit unfortunate that //italics// use the same characters that is used for //code-comments in (most?) code. It would be nice to copy-paste code into TW and have the //code-comments be recognized and formatted differently from the code.


@Danielo - maybe the above has answered your point implicitly, but to be explicit: One should easily be able to intersperse comments and other formatting in the code. Note that it isn't really code - it is notes on code - and as such the notational aspects are important.

<:-)

Mat

unread,
Oct 16, 2015, 1:02:06 PM10/16/15
to TiddlyWiki
Jed/Danielo
 
I think that, particularly when learning but even after that, it would be very nice to be able to have a long function that uses many other functions and just be able to click on a function name to open up the code for that function and its documentation. I think it is a matter of 'pretty good' and 'better', not that the current possibilities are bad.

Yeah, that aspect too. And, actually, this is a particularly desirable feature for notes on the very TW code because I find TWs often have textual content about the TW tool itself. A prime example is how the documentation is written in... TW/wikitext. Other coding languages are mostly built to produce separate applications but with TW I find I'm typically always in a kind of semi-coding environment even if it is the TW application. We're even using the same interface and editor for adding a simple textual note like "Buy milk" as for code and widgets like "<$list filter="..."


<:-)


Reply all
Reply to author
Forward
0 new messages