How to display .html, .css and .js sourcecode and allow to copy it to the clipboard

As asked in the title above: What is the tiddlywiki-way to display, normal html, cs and js - not only wikitext and allow to pinch it to the clipboard.?
Perhaps I am stupid, but the way, I tried to do it, it did not display…even after importing $:/editions/tw5.com/doc-macros

Okay:
What a difference a makes… just six little chars :wink: … and everything afterwards is hidden.

But now: Is there a way to prevent “that renders as…” if the code should not render. I am working on this and will be back .

Let’s assume the content you want to display/copy is in a tiddler named “stuff”.

To copy it to the clipboard and also render it as sourcecode, you can write:

<$macrocall $name=copy-to-clipboard src={{stuff}}/>
<$codeblock code={{stuff}}/>

-e

3 Likes

Thank you @EricShulman ! I just made a show-code plugin. $__plugins_JJ_showcode.json (385 Bytes).
The advantage is that you do not need a tiddler to transclude and can use it inline like:

<$macrocall $name="show-code-to-copy" 
src="""<codestuff>"""/>
1 Like