sillycode 0.0.5

Fast and safe implementation of sillycode parsing and rendering
Documentation
# sillycode ![]https://sillypost.net/static/emoticons/smile.png
Fast and safe sillycode parsing and rendering libraries for both Rust and JavaScript/TypeScript.

Each library implementation provides functionality to parse sillycode markup into structured parts and render them as HTML.
For more information on sillycode and its syntax, see the [sillycode guide](https://sillypost.net/sillycode_guide).

## Installation

### JavaScript/TypeScript
```bash
npm install sillycode
```

### Rust
```toml
[dependencies]
sillycode = "0.0.5"
```

## Usage

### JavaScript/TypeScript
```typescript
import { parse, render } from 'sillycode';

const input = "[b]Hello[/b] [:)]";
const parts = parse(input);
const html = render(parts, false);

console.log(html);
```

### Rust
```rust
use sillycode::{parse, render};

let input = "[b]Hello[/b] [:)]";
let parts = parse(input);
let html = render(parts, false);

println!("{}", html);
```

## API Reference

### JavaScript/TypeScript
For comprehensive information, including type definitions, for the JS/TS API, visit [sillycode.netlify.app](https://sillycode.netlify.app/).

#### Core Functions
- `parse(input: string): Part[]` - Parse sillycode markup into structured parts
- `render(parts: Part[], isEditor?: boolean, emoteSrcPrefix?: string): string` - Render parts to HTML
- `length(parts: Part[]): number` - Calculate display length of parts

#### DOM Utilities
- `reverse($root: HTMLElement): string` - Extract sillycode markup from DOM elements
- `diff($expected: HTMLElement, $actual: HTMLElement): boolean` - Efficiently diff and update DOM trees

### Rust
Note that, unlike the JavaScript version, the Rust version doesn't support customizing the emote source prefix. Consider using a simple string replace instead.

#### Core Functions
- `parse(input: &str) -> Vec<Part>` - Parse sillycode markup into structured parts
- `render(parts: impl IntoIterator<Item = Part>, is_editor: bool) -> String` - Render parts to HTML
- `length(parts: &[Part]) -> usize` - Calculate display length of parts

#### Types
- `Part` - Enum for all parsed parts (text, style, emote, color, etc.)
- `StyleKind` - Enum for style types (bold, italic, underline, etc.)
- `EmoteKind` - Enum for emote types (smile, sad, etc.)
- `Color` - Type alias for color strings

## Authors
Made with ❤ by Lua ([foxgirl.dev](https://foxgirl.dev/)) :3c

## License
This project is licensed under [MIT](LICENSE).
More info in the [LICENSE](LICENSE) file.