Skip to content

Commit

Permalink
A better readme
Browse files Browse the repository at this point in the history
  • Loading branch information
eiriksm committed Sep 30, 2024
1 parent 773ed75 commit 857043c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,46 @@
Transform data coming from FS to regular and usable HTML

[![Test](https://github.com/frontkom/fs-info-transformer/actions/workflows/test.yml/badge.svg)](https://github.com/frontkom/fs-info-transformer/actions/workflows/test.yml)

## Installation

Install with composer.

```bash
composer require frontkom/fs-info-transformer
```

## Usage

```php
use Frontkom\FsInfoTransformer\Transformer;

$transformer = new Transformer();
$text = 'Vi viser til <webLink><href>https://www.example.com</href><linkName>gjeldende forskrift og tilhørende retningslinjer.</linkName></webLink>';
$html = $transformer->transform($text);
echo $html;
// Will output
// Vi viser til <a rel="nofollow" href="https://www.example.com">gjeldende forskrift og tilhørende retningslinjer.</a>
```

## API

### `transform(string $text): string`

Transforms the given text to HTML.

This method will run all the most common transformations on the text, including most of the ones below. For a direct link to read the implementation, [see the method in the source code directly.](https://github.com/frontkom/fs-info-transformer/blob/main/src/Transformer.php#L7)

### `replaceEmptyParagraphs(string $text): string`

### `processBulletedLists(string $text): string`

### `processNumberedLists(string $text): string`

### `replaceTags(string $data, $tag, $replacement_tag, $keep_self_closing_tags = false): string`

### `processWeblinks(string $data, bool $nofollow = true): string`

## License

GPL-2.0-or-later

0 comments on commit 857043c

Please sign in to comment.