<commit_before>## À la carte: make your own bundle

Predefined bundles are nice, but they're not configurable. Here's how you can create your own bundle. For convenience, we'll base our custom bundle on the default "Forum" bundle.

```php
$configurator = new s9e\TextFormatter\Configurator;
$configurator->loadBundle('Forum');

// Add your own BBCode
$configurator->BBCodes->addCustom(
	'[huge]{TEXT}[/huge]',
	'<span style="font-size:200px">{TEXT}</span>'
);

// Add your own emoticons
$configurator->Emoticons->set(':lol:', '<img src="/path/to/lol.png" alt="LOL"/>');
$configurator->Emoticons->set(':mad:', '<img src="/path/to/mad.png" alt="Mad"/>');

// Also, we want the output to be XHTML, not HTML
$configurator->stylesheet->outputMethod = 'xml';

// Save the bundle to /tmp/Bundle.php
$configurator->saveBundle('My\Bundle', '/tmp/Bundle.php');

// Test your bundle now (notice how [i] was created by the Forum bundle configurator)
include '/tmp/Bundle.php';
$xml  = My\Bundle::parse('[huge][i]Hello[/i][/huge] :lol:');
$html = My\Bundle::render($xml);
<commit_msg>Updated doc [ci skip]<commit_after>## À la carte: make your own bundle

Predefined bundles are nice, but they're not configurable. Here's how you can create your own bundle. For convenience, we'll base our custom bundle on the default "Forum" bundle. We load the bundle in our configurator, extend/reconfigure it and save it under a new name.

```php
$configurator = new s9e\TextFormatter\Configurator;
$configurator->loadBundle('Forum');

// Add your own BBCode
$configurator->BBCodes->addCustom(
	'[huge]{TEXT}[/huge]',
	'<span style="font-size:200px">{TEXT}</span>'
);

// Add your own emoticons
$configurator->Emoticons->set(':lol:', '<img src="/path/to/lol.png" alt="LOL"/>');
$configurator->Emoticons->set(':mad:', '<img src="/path/to/mad.png" alt="Mad"/>');

// Also, we want the output to be XHTML, not HTML
$configurator->stylesheet->outputMethod = 'xml';

// OPTIONAL: we use the PHP renderer instead of the default XSL renderer.
//           It will create a new class file in the /tmp directory
$configurator->setRendererGenerator('PHP', '/tmp');

// Save the bundle to /tmp/Bundle.php
$configurator->saveBundle('My\Bundle', '/tmp/Bundle.php');

// Test your bundle now (notice how [i] was created by the Forum bundle configurator)
include '/tmp/Bundle.php';
$xml  = My\Bundle::parse('[huge][i]Hello[/i][/huge] :lol:');
$html = My\Bundle::render($xml);

{'fraction_non_alphanumeric': 0.17405582922824303, 'fraction_numerical': 0.003284072249589491, 'mean_word_length': 4.886473429951691, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 32, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4558117', 'n_tokens_mistral': 828, 'n_tokens_neox': 813, 'n_words': 246}