Formatting links (e.g. adding //emphasis//)

Is there a way in TW to format internal links themselves, for example:

[[//Internal link//|example in italics]]

I believe I can change CSS precedences with !important but this failed in my experiments and I am not confident with the language. I am also concerned about possible side effects.

I have been copying over some old but important documents into TW. One large set of documents/notes relies a lot on formatting and is also replete with links, and relies on them to a large extent. I would otherwise have to rethink all the information presented there, which I am trying to avoid.

Edit: this will always work for external links.

Hi,

Maybe you can do what you want using the <$link> widget instead of the WikiText syntax?
Have a look at the official documentation for the link widget here.

Fred

Examples:

<$link to="target tiddler title">Here a //label//</$link>

or, for an external link:

<a href="https://blah...">Here a //label//</a>

Yan, You are adding italics not emphasis, which happens to also be set by default to italics.

Remember by default links to missing tiddlers are italic, so if you make all links italic, you loose access to this information. That is fine if you don’t mind. But you may confuse other tiddlywiki users.

Yan, you may be interested in the many variations on the idea of using something other than tiddler titles for links. Tiddler titles should not contain style markup, and aren’t designed to be wikified — but other fields can include such markup, and are designed to be wikified.

For example, all of my TiddlyWiki projects that include bibliographic resources harness the caption field for links, because the caption field can include italics and other special characters, as needed to make a proper reference to a book title within a string that also includes non-italic elements. Here’s an example:

https://biblio-springer.tiddlyhost.com/#bannon2016nature

I hope this is helpful! Feel free to follow up.

Formatting needs a start and an end marker outside the link marker

//[[Internal link|example in italics]]//

''[[External link|http://www.example.com]]'' that should be in bold.

Thank you all for your suggestions. So far I may have to go with @tw-FRed’s solution but @Springer’s is also promising.

Two points to address first:

Thanks, I am aware of that per the subject of the topic. I have long changed this setting so they are red links, MediaWiki style.
I will say that TW WikiText is unusual in terms of lightweight markup languages, as the enclosing item normally sets formatting in all cases.

I was thoughless in mentioning external links, where this always works (confirmed just now). I’ve edited it out of the top post to avoid confusion.

Unfortunately, this does not work with internal links. I tried this in an empty TiddlyWiki as well.

I like this concept. I can transclude the caption and this might be the way I go about it, probably through a macro.

I am concerned that macros are marked as “superseded” officially so they may suddenly stop working in a future version, but it’ll do for now.

You are right. Italic works the way I did describe it. Bold needs a style definition.

title: link-styles
tags: $:/tags/Stylesheet

strong .tc-tiddlylink {
  font-weight: bolder;
}

This does work for me. I’ll have a closer look, if this is worth an issue and a PR at GitHub

Edit: [Bug] wikitext formatting a link in italic works - bold does not work · Issue #8162 · Jermolene/TiddlyWiki5 · GitHub

Edit 2: I also did a PR and Jeremy found out that the code above creates “false positives” – So it actually needs a bit more support from the core parsers. There is a PR at GH

Actually this just means there are new recommended ways. Even when “deprecated” you can rely on backwards compatibility at least until a major version upgrade, if not further.

Macros can usually be replaced with procedures easily, if you are concerned.

1 Like