# Pukram formatting
[](https://crates.io/crates/pukram-formatting)
[](https://docs.rs/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;
### Format Checking
```rust
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
// 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).