text-tags 0.1.0

A lightweight, text-tag markup parser
Documentation
  • Coverage
  • 0%
    0 out of 24 items documented0 out of 8 items with examples
  • Size
  • Source code size: 14.94 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 513.12 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 11s Average build duration of successful builds.
  • all releases: 11s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • piot

text-tags

A lightweight Rust crate for parsing text-tags.

Features

  • Uniform tag syntax: [tag arg1 arg2=val2 ...]content[/tag]
  • Implicit first argument: The first value (e.g. font name, hex color, atlas index) may be written without a key.
  • Named arguments: Any additional arguments use key=value form.
  • Strong types: Supports ints, floats, bools, hex colors, keywords, and quoted strings.
  • Nested tags: Tags can wrap content and nest arbitrarily.

Syntax Overview

Basic tags

[b]Bold text[/b]
[i]Italic text[/i]

Implicit first argument

  • Example Font: [font Arial size=24]Text[/font] -> font name is "Arial"
  • Example Color: [color #ff00aa a=0.8]Colored[/color] -> hex #ff00aa, alpha 0.8
  • Example Sprite: [sprite 3 index=5] -> atlas 3, index=5

Named arguments

[font name="Comic Sans" size=20 weight=700]
[color r=1.0 g=0.2 b=0.2]

Argument types

  • Int: val=42
  • Float: pi=3.14
  • Bool: enabled=true
  • Hex: color=#aabbcc
  • Keyword: mode=wrap
  • String: label="Hello World"

Examples

This is [font Arial size=18]rendered[/font] with [color #00ff00]green[/color] text,
and an icon: [sprite atlas=1 index=2].

Usage

in Cargo.toml:

[dependencies]
text-tags = "0.1.0"