pukram-formatting 0.2.2

A type to represent the formatting of the pukram markup language
Documentation
# Pukram formatting

[![crates.io](https://img.shields.io/crates/v/pukram-formatting)](https://crates.io/crates/pukram-formatting)
[![docs.rs](https://img.shields.io/docsrs/pukram-formatting)](https://docs.rs/pukram-formatting)
[![License](https://img.shields.io/crates/l/pukram-formatting)](LICENSE-MIT OR LICENSE-APACHE)

A Rust library for combining text formatting styles using bitwise operations. Designed for the pukram markup language.

## Features

- Several supported formattings:
  - `*bold*`
  - `/italic/`
  - `` `monospace` ``
  - `^superscript^`
  - `|subscript|`
  - `_underscore_`
  - `~strikethrough~`
- Bitwise operator support (`|`, `&`, `^`, etc.)
- Toggle formats with marker characters

## Usage

### Basic Formatting

```rust
use pukram_formatting::Formatting;

// Combine formats with bitwise OR
let bold_underscore = Formatting::BOLD | Formatting::UNDERSCORE;
let small = Formatting::TOP | Formatting::BOTTOM;
```

### Format Checking

```rust
let mut fmt = Formatting::BOLD | Formatting::ITALIC;

assert!(fmt.is_bold());
assert!(fmt.contains(Formatting::ITALIC));
assert!(!fmt.is_strikethrough());

// Remove bold formatting
fmt ^= Formatting::BOLD;
assert!(!fmt.is_bold());
```

### Character-Activated Formatting

```rust
let mut fmt = Formatting::default();

// Toggle formats using marker characters
fmt.apply('*');  // Toggle bold
fmt.apply('/');  // Toggle italic
fmt.apply('`');  // Toggle monospace

// Invalid characters are ignored
assert!(!fmt.apply('x'));  // Returns false
```

When parsing a text to add formatting, you would usually use this.

### Combined Formatting

```rust
// Create complex combinations
let warning = Formatting::BOLD | Formatting::UNDERSCORE | Formatting::STRIKETHROUGH;

// Mix with bitwise operations
let modified_warning = warning ^ (Formatting::UNDERSCORE | Formatting::BOLD);
```

## Documentation

Full API reference available at [docs.rs/pukram-formatting](https://docs.rs/pukram-formatting).