Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dedalozzo/converter
A set of classes to translate a text from a HTML to BBcode and from BBCode to Markdown.
https://github.com/dedalozzo/converter
bbcode bbcode-to-markdown converter html html-to-bbcode html-to-markdown markdown php
Last synced: 4 days ago
JSON representation
A set of classes to translate a text from a HTML to BBcode and from BBCode to Markdown.
- Host: GitHub
- URL: https://github.com/dedalozzo/converter
- Owner: dedalozzo
- License: apache-2.0
- Created: 2013-08-06T14:29:25.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2021-04-20T03:26:50.000Z (over 3 years ago)
- Last Synced: 2024-10-20T11:50:29.096Z (27 days ago)
- Topics: bbcode, bbcode-to-markdown, converter, html, html-to-bbcode, html-to-markdown, markdown, php
- Language: PHP
- Size: 71.3 KB
- Stars: 27
- Watchers: 5
- Forks: 9
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Latest Stable Version](https://poser.pugx.org/3f/converter/v/stable.png)](https://packagist.org/packages/3f/converter)
[![Latest Unstable Version](https://poser.pugx.org/3f/converter/v/unstable.png)](https://packagist.org/packages/3f/converter)
[![Build Status](https://scrutinizer-ci.com/g/dedalozzo/converter/badges/build.png?b=master)](https://scrutinizer-ci.com/g/dedalozzo/converter/build-status/master)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/dedalozzo/converter/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/dedalozzo/converter/?branch=master)
[![License](https://poser.pugx.org/3f/converter/license.svg)](https://packagist.org/packages/3f/converter)
[![Total Downloads](https://poser.pugx.org/3f/converter/downloads.png)](https://packagist.org/packages/3f/converter)Converter
=========
A set of classes to translate a text **from HTML to BBCode** and **from BBCode to Markdown**.The HTML to BBCode converter, in particular, has not been created with the intent to convert an entire HTML page, but
just to convert a set of HTML tags used to format articles and blog posts in the HTML era, when Markdown and BBcode
didn't exist at all.The special BBCode to Markdown converter is able to convert: bold, italic, underline and strikethrough texts, lists,
urls, images, quotes and even code blocks (snippets).Composer Installation
---------------------To install Converter, you first need to install [Composer](http://getcomposer.org/), a Package Manager for
PHP, following these few [steps](http://getcomposer.org/doc/00-intro.md#installation-nix):```sh
curl -s https://getcomposer.org/installer | php
```You can run this command to easily access composer from anywhere on your system:
```sh
sudo mv composer.phar /usr/local/bin/composer
```Converter Installation
----------------------
Once you have installed Composer, it's easy install Converter.1. Edit your `composer.json` file, adding Converter to the require section:
```sh
{
"require": {
"3f/converter": "dev-master"
},
}
```
2. Run the following command in your project root dir:
```sh
composer update
```Usage
-----
There are two classes: `HTMLConverter` and `BBCodeConverter`. The first class may be used to convert from HTML to
BBCode, while the second one is used to convert from BBCode to Markdown.HTML to BBCode conversion:
```php
$converter = new Converter\HTMLConverter($text, $id);
echo $converter->toBBCode();
```BBCode to Markdown conversion:
```php
$converter = new Converter\BBCodeConverter($text, $id);
echo $converter->toMarkdown();
```In both cases the `$id` is optional. When provided is used in case an exception is raised during the conversion process.
Documentation
-------------
The documentation can be generated using [Doxygen](http://doxygen.org). A `Doxyfile` is provided for your convenience.Requirements
------------
- PHP 5.4.0 or above.Authors
-------
Filippo F. Fadda - -License
-------
Converter is licensed under the Apache License, Version 2.0 - see the LICENSE file for details.