Re: [tw] [TW5] using highlight.js for transcluded code

213 views
Skip to first unread message

Jeremy Ruston

unread,
Oct 4, 2015, 5:46:01 PM10/4/15
to tiddl...@googlegroups.com
Hi Tobias


Using highlight plugin, how would I actually highlight the source of a core tiddler rather than the code to retrieve it?

For example:

```javascript
<$view tiddler="$:/core" subtiddler="$:/core/modules/startup/info.js"/>
```


The codeblock widget appears to be missing any documentation.

Trying to decipher it, I noticed that this won't work:

<$codeblock language="javascript"><$view tiddler=<<core>> subtiddler={{!!subtiddler}}/></codeblock>

So, how would I do...

<$codeblock language="javascript" code=?!?>/>

Try:

<$codeblock language=“javascript” code={{MyJavaScriptTiddler}}/>

Best wishes

Jeremy.



Best wishes,

— tb

--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit https://groups.google.com/d/msgid/tiddlywiki/a846ef32-9f1f-4540-b721-c84849cef90b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Danielo Rodríguez

unread,
Oct 5, 2015, 9:30:20 AM10/5/15
to TiddlyWiki
Try:

<$codeblock language=“javascript” code={{MyJavaScriptTiddler}}/>

Best wishes

Jeremy.

This is very interesting!! you can have external code files, and display them properly on the wiki without modifying the original file.

Awesome. 

Jeremy Ruston

unread,
Oct 5, 2015, 9:32:10 AM10/5/15
to tiddl...@googlegroups.com
Hi Danielo


This is very interesting!! you can have external code files, and display them properly on the wiki without modifying the original file.

No, I’m afraid not. The codeblock widget just displays the value of the code attribute. It doesn’t do any external file access.

You’re not going to get any better than the external file access that’s already been added to 5.1.10, because that’s all that browsers permit us to do.

Best wishes

Jeremy.



Awesome. 

--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.

Danielo Rodríguez

unread,
Oct 5, 2015, 9:36:30 AM10/5/15
to TiddlyWiki
No, I’m afraid not. The codeblock widget just displays the value of the code attribute. It doesn’t do any external file access.

You’re not going to get any better than the external file access that’s already been added to 5.1.10, because that’s all that browsers permit us to do.

Best wishes

Jeremy.

That depends on the platform! I can import a tiddler as an external file (like the Alicia's tiddler) and then transclude it with text. Can't I ? 
And even if that is not possible, there is at least one project I am working at that can make good use of this.

Regards

Tobias Beer

unread,
Oct 6, 2015, 7:37:15 AM10/6/15
to tiddl...@googlegroups.com
Hi Jeremy,
 
Try: <$codeblock language=“javascript” code={{MyJavaScriptTiddler}}/>
 
Of course. Always the basics. :D

@Danielo,

there is at least one project I am working at that can make good use of this.Enter code here...

me2: exploring TW core code / making that more accessible

— tb

Jeremy Ruston

unread,
Oct 6, 2015, 8:42:29 AM10/6/15
to tiddl...@googlegroups.com
Hi Danielo

That depends on the platform! I can import a tiddler as an external file (like the Alicia's tiddler) and then transclude it with text. Can't I ? 
And even if that is not possible, there is at least one project I am working at that can make good use of this.

What I’m trying to say is that the codeblock widget doesn’t have any impact on the functionality available for loading remote content. it is a presentation feature, and nothing to do with loading external content.

So, yes, you can use the codeblock widget to view the content of a tiddler loaded via the new external text tiddler support, but the two features are entirely independent.

Best wishes

Jeremy



Regards

--
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 tiddlywiki+...@googlegroups.com.
To post to this group, send email to tiddl...@googlegroups.com.
Visit this group at http://groups.google.com/group/tiddlywiki.

James

unread,
Oct 6, 2015, 11:17:24 PM10/6/15
to TiddlyWiki
Hi Jeremy,

Can I use codeblock for external file?  For instance:

<$codeblock language="vb" />
<<includeCode file:"myscript.vb">>
</$codeblock>

Danielo Rodríguez

unread,
Oct 7, 2015, 5:17:58 AM10/7/15
to TiddlyWiki

El miércoles, 7 de octubre de 2015, 5:17:24 (UTC+2), James escribió:
Hi Jeremy,

Can I use codeblock for external file?  For instance:

<$codeblock language="vb" />
<<includeCode file:"myscript.vb">>
</$codeblock>

You should first create a tiddler including myscript.vb as an external file (as far as I know) using cannonical_uri field, and then transculde it like this:

<$codeblock language=“javascript” code={{myscript}}/> 

Regards

leoperbo

unread,
Jun 10, 2019, 1:54:25 PM6/10/19
to tiddl...@googlegroups.com
For what is worth, in TW 5.1.19 I tried:

<$codeblock language="bash" code={{my_bash_script.sh}}/>


And didn't get highlights, but when I tried without doble quotes arround language value:

<$codeblock language=bash code={{my_bash_script.sh}}/>

The highlights appeared.

El domingo, 4 de octubre de 2015, 16:46:01 (UTC-5), Jeremy Ruston escribió:
Hi Tobias


Using highlight plugin, how would I actually highlight the source of a core tiddler rather than the code to retrieve it?

For example:

```javascript
<$view tiddler="$:/core" subtiddler="$:/core/modules/startup/info.js"/>
```


The codeblock widget appears to be missing any documentation.

Trying to decipher it, I noticed that this won't work:

<$codeblock language="javascript"><$view tiddler=<<core>> subtiddler={{!!subtiddler}}/></codeblock>

So, how would I do...

<$codeblock language="javascript" code=?!?>/>

Try:

<$codeblock language=“javascript” code={{MyJavaScriptTiddler}}/>

Best wishes

Jeremy.



Best wishes,

— tb

--
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 tiddl...@googlegroups.com.

Jeremy Ruston

unread,
Jun 10, 2019, 4:29:16 PM6/10/19
to tiddl...@googlegroups.com
Hi Leoperbo

That shouldn’t be the case. I wonder if there’s something else going on: I can't duplicate the problem on https://tiddlywiki.com/editions/full/index.html


Best wishes

Jeremy


For what is worth, in TW 5.1.19 I tried:

<$codeblock language="bash" code={{my_bash_script.sh}}/>


And didn't get highlights, but when I tried without doble quotes arround language value:

<$codeblock language=bash code={{my_bash_script.sh}}/>

And the highlights appeared.
To unsubscribe from this group and stop receiving emails from it, send an email to tiddlywiki+...@googlegroups.com.

To post to this group, send email to tiddl...@googlegroups.com.

leoperbo

unread,
Jun 10, 2019, 7:54:08 PM6/10/19
to tiddl...@googlegroups.com
Your answer pushed me to verify and I found a custom general stylesheet which includes a custom color for "code", commented it and then the transclusion via codeblock widget worked honoring the standard.

Is curious that had been working without double quotes too...

Thank you and sorry for the false "bug"!
Reply all
Reply to author
Forward
0 new messages