TextFormattingPlugin? (like HTMLFormattingPlugin)

18 views
Skip to first unread message

Jeff Ivany

unread,
Apr 26, 2009, 5:17:03 PM4/26/09
to TiddlyWiki
Hi,

Is there already a plugin that allows processing of wiki markup within
a "monospace text" block, sort of like how the HTMLFormattingPlugin
works with HTML? I want to be able to use the AnnotationPlugin on text
that is within a monospace block.

I realize there are many reasons to not process the monospace text
blocks. I've looked at the enclosedTextHelper and the other
formatting code but I can't seem to wrap my head around how to
"properly" hijack that helper to process for AnnotationPlugin notes
only.

Thanks,

Jeff

Eric Shulman

unread,
Apr 26, 2009, 6:45:00 PM4/26/09
to TiddlyWiki
> Is there already a plugin that allows processing of wiki markup within
> a "monospace text" block, sort of like how the HTMLFormattingPlugin
> works with HTML?

Instead of using a TiddlyWiki 'monospace block', e.g.:

{{{
... your content here...
}}}

you could use real HTML to define the <pre>...</pre> block, like this:

<html><pre>...your content here...</pre></html>

This will render the content with the same styles as the TW-formatted
block (monospaced font, no word wrap, yellow background with border),
and then HTMLFormattingPlugin kicks in to also process the wiki syntax
with the block.

Note: if you want the text to wrap, then add a little bit of 'inline
CSS', like this:

<html><pre>@@white-space:normal;...your content here...@@</pre></html>

enjoy,
-e
Eric Shulman
TiddlyTools / ELS Design Studios

Jeff Ivany

unread,
Apr 26, 2009, 7:37:26 PM4/26/09
to TiddlyWiki
Thanks for pointing out the totally obvious solution I missed! :)
That's much easier than trying to hijack the monospace text formatter.

Thanks!

Jeff

Marc J. Cawood

unread,
Nov 24, 2012, 1:47:37 PM11/24/12
to tiddl...@googlegroups.com, TiddlyWiki
For anyone else who battled trying to hijack this type of function here is the solution:
config.formatterHelpers.enclosedTextHelper_old = config.formatterHelpers.enclosedTextHelper;
config.formatterHelpers.enclosedTextHelper = function(w) {
config.formatterHelpers.enclosedTextHelper_old.call(this, w);
prettyPrint();
}

Thie "magic" seems to be this .call(this, w) but I can't explain what exactly is going on here.
Reply all
Reply to author
Forward
0 new messages