`). Each formatted element may wrap its original BBCode markup in `` (start) and `` (end) tags — Markbridge ignores these during parsing.
## Supported elements
| Element | Renders as | AST node |
| ------------------------- | ------------------------------------------------ | --------------------- |
| `` | `**bold**` | `AST::Bold` |
| `` | `*italic*` | `AST::Italic` |
| `` | `~~strike~~` | `AST::Strikethrough` |
| `` | `underline` | `AST::Underline` |
| `` | Fenced code block, including single-line content | `AST::Code` |
| `` | `[text](href)` | `AST::Url` |
| `` | `[text](mailto:addr)` | `AST::Url` |
| `
` | `` | `AST::Image` |
| `` | Discourse upload syntax | `AST::Attachment` |
| `` | `[quote]…[/quote]` | `AST::Quote` |
| `` | `- item` / `1. item` | `AST::List` |
| `` | List item | `AST::ListItem` |
| ``, ``, `` | GFM table | `AST::Table` |
| `
` | `---` | `AST::HorizontalRule` |
| `
` | Hard line break | `AST::LineBreak` |
Several elements carry attributes Markbridge reads: `` (`lang`), `` (`url`), `` (`email`), `
` (`src`), `` (`type` — `bullet` or `decimal`), and `` (attribution).
For the exact list, see [`HandlerRegistry.default`](https://github.com/discourse/markbridge/blob/main/lib/markbridge/parsers/text_formatter/handler_registry.rb).
## Using the parser directly
```ruby
parser = Markbridge::Parsers::TextFormatter::Parser.new
ast = parser.parse(xml)
renderer = Markbridge::Renderers::Discourse::Renderer.new
renderer.render(ast)
```
## Behavior notes
* **Invalid XML** falls back to treating the input as plain text instead of raising.
* **Unknown elements** are skipped — their children are still processed.
* **Stateless handler API**: like the HTML parser, handlers are callables receiving `(element:, parent:, processor:)`. The `processor:` argument is the parser instance and exposes `process_children(xml_element, ast_node)` for handlers that want to recurse manually. Lambdas are accepted.
## When to use this vs. the BBCode parser
If you’re migrating **from** phpBB 3.2+ and already have the stored XML, use this parser — it’s both faster and closer to the source of truth than re-parsing the BBCode. For plain BBCode from other forums, use the [BBCode parser](/format-guides/bbcode/).