Skip to content

v0.19.0-beta.1

Choose a tag to compare

@razkar-studio razkar-studio released this 01 Jun 07:33

0.19 Beta

frb0.19.0-beta.1, core0.14.0-beta.1, macros0.7.0-beta.1, md0.2.3

New Macros

  • cformat! / cformatb!: the new standard formatting interface. Replaces color_fmt! with full format-string power: Rust 2024 implicit captures (cformat!("[red]{name}")) and named arguments (cformat!("[green]{greeting}", greeting = "hi")).
  • untag!(): doubles [/] so they survive the lexer as literal text. Perfect for displaying markup examples in terminal UIs without them being interpreted as tags.

Inline Markdown (new inline feature)

A new inline feature lets you use lightweight markdown-like syntax inside c* macros:

Syntax Result
`code` inline code (styled via auto-registered "code" style)
*text* bold
/text/ italic
_text_ underline

Double any marker to show it literally: **literal**, //literal//, __literal__.

color_runtime automatically sets up a default style for code spans.

New Escape Syntax

[[ produces a literal [, and ]] produces a literal ]. This replaces the old \[ syntax (which is now removed). Multiple brackets follow greedy left-to-right pairing, so ]]] becomes ]].

Easier Macro Renames

  • ansi_strip! is now unansi!
  • markup_strip! is now unmarkup!

The old names still work but show a deprecation warning.

All Macros Accept Any Format Arguments

Every c*, md*, un*, and ce* macro now accepts $($rest:tt)* instead of the restrictive $(, $arg:expr)*. This means Rust 2024 implicit format captures and named arguments work everywhere, not just in the new cformat! macros.

Whitespace in Tag Groups

Whitespace inside (...) groups in tags is now preserved. rgb(1, 2, 3) and ansi( 93 ) survive as single tags instead of being split on inner spaces.

Style Names as Reset Targets

Custom style names can now be used as reset targets. Writing [style_name] reapplies all previously active styles in reverse order.

SGR Reset Fix

SGR reset sequences appended by try_color, color_runtime, and friends are now gated behind color_enabled(). They no longer emit escape codes when colors are disabled via NO_COLOR / FORCE_COLOR.

Deprecations

  • color_fmt!: use cformat! instead.
  • Full markdown feature (including md_fmt!, mdprint!, mdprintln!, mdeprint!, mdeprintln!, and farben-md itself): will be removed after 0.19 stable. Migrate to the new inline feature.

Breaking Changes

What changed How to update
\[ escape removed Replace \[ with [[ in all markup strings
insert_style returns Result<(), RegistryError> Handle the Result, or keep using style!() (unaffected)
Prelude trimmed (try_color, strip_ansi, RegistryError, Style, insert_style, set_prefix, color_fmt! removed) Add explicit imports for any you still need
Inline markdown: _ now means underline, / means italic If you were using the inline feature, update _ italic markup to /