Adrian
Adrian

Reputation: 31

In TiddlyWiki 5, how do I prevent the text inside a code block from wrapping?

I'm using TiddlyWiki 5.1.5, and I've been struggling with a particular problem for the last 2 days.

I have searched the web using various search terms in Google to try and see if there are any solutions already out there for this.

When I declare a code block in a TiddlyWiki 5 (TW5) tiddler, and insert text inside this code block, I want the code block to scroll across when there is a long line of text. Instead, the code block is wrapping the text automatically. I want to the code block to scroll, not auto-wrap long lines of text.

I've even tried using explicit and HTML tags, but long lines of text are still wrapped.

I've tried this with Chrome, Safari, and even the TiddlyWiki Desktop app. No success.

Has anyone encountered this and what was your solution or workaround please?

Thank you.

Upvotes: 3

Views: 2174

Answers (2)

leoperbo
leoperbo

Reputation: 111

To prevent overflow like this:

Block of code overflow to sidebar

I would create a tiddler tagged with $:/tags/Stylesheet and this content as text:

pre, code {
overflow: scroll;
white-space: pre;
}

Then, I get this: enter image description here

Upvotes: 1

hhana
hhana

Reputation: 21

For this you have to modify the CSS of the pre/code tag used by TiddlyWiki. Put this in a tiddler and tag it with $:/tags/Stylesheet:

pre, code {
    word-wrap: normal;
    white-space: pre;
}

Upvotes: 2

Related Questions