Style Text Node

john's Avatar

john

15 Mar, 2020 12:34 AM

Style_text provides something we normally take for granted but which until now has been all-but-impossible in Nodebox: paragraphs of styled text with some words in bold, some in italics, and even some in a different color than the rest.

The style_text node uses a "mini markdown" notation to produce a list of word paths that can be styled bold or italic or both and/or set to a special color. By feeding these word paths into my arrange node (http://support.nodebox.net/discussions/show-your-work/364-arrange-node) you can easily create labels or paragraphs with mixed styles.

Feed in your text as a string using the following notations:

  • Italics: surround a word or phrase with a single asterisk

  • Bold: surround a word or phrase with a pair of asterisks

  • Bold Italics: surround a word or phrase with triplets of asterisks (or a word inside single asterisks within a phase inside double asterisks or vice versa)

  • Color: surround a word of phrase with tildes (~) to colorize it using a special color

This is a subset of standard Markdown notation except that here tildes are used to specify color instead of strike-though. You can combine tildes and asterisks to render color changes and text stylings at the same time.

The node settings allow you to specify the font size and the fonts used for plain text, italic text, bold text, and bold italic text. If desired, you could use these font selections to achieve other styles like condensed text, semi-bold, etc. You can also specify the regular text color and the special color for specially marked words and phrases. The special color could be a bright color like red (useful for warnings) or a slightly darker or lighter variation of the regular color to achieve more subtle forms of emphasis.

See attached screenshot for an example. Both the text_style and arrange nodes are included in the zipped demo file. Both nodes will be included in the next release of my node library.

Comments welcome! Enjoy!

John

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Already uploaded files

  • style_text_screenshot.png 506 KB
  • style_text_demo.zip 9.22 KB

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

05 Apr, 2020 10:29 PM
02 Apr, 2020 07:12 PM
31 Mar, 2020 07:58 AM
31 Mar, 2020 04:13 AM
31 Mar, 2020 03:23 AM

 

27 Mar, 2020 03:55 AM
27 Mar, 2020 03:25 AM
15 Mar, 2020 09:06 PM
15 Mar, 2020 12:34 AM
14 Mar, 2020 11:59 PM
11 Mar, 2020 06:48 PM