I've come up with a quick and dirty hack by replacing

codeNode.appendChild(this.document.createTextNode(this.getAttribute("code"
)));

with

        var t = this.getAttribute("code").split(/(\[\[.+?\]\])/); 
        for (var i = 0; i < t.length; i++) { 
          if (i % 2 === 0) { 
            codeNode.appendChild(this.document.createTextNode(t[i])); 
          } else { 
            var a = this.document.createElement("a"); 
            var s = t[i].slice(2, -2); 
            a.setAttribute("href", "#" + encodeURIComponent(s)); 
            a.appendChild(this.document.createTextNode(s)); 
            codeNode.appendChild(a); 
          } 
        } 


in $:/core/modules/widgets/codeblock.js

but I definitely eager to have a chance for a proper, flexible and clean 
solution!

вторник, 10 мая 2016 г., 19:51:48 UTC+3 пользователь Ruslan Prokopchuk 
написал:
>
> Hi!
>
> I think TiddlyWiki fits perfectly for literate programming. The only thing 
> I miss (except tangling sources for passing to the compiler, but it is easy 
> implemented as an external tool) is an ability to support wikilinks in 
> codeblocks. I mean that stuff like that:
>
> ```
> function parentChunk() {
>   console.log("let's include another chunk below");
>   // [[Included chunk name]]
> }
> ```
>
> to be rendered as
>
> function parentChunk() {
>   console.log("let's include another chunk below");
>   // Included chunk name <http:///>  <---- link to the tiddler! <a> tags 
> are allowed inside <pre> and <code> ones AFAIK
> }
>
> Is it possible to shadow codeblock macro to add support for that? How to 
> do that?
>
>

-- 
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 https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/b82219b8-19dc-48b3-a142-0f461f0ad4d1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to