interpret
interpret copied to clipboard
2.0
The current Interpreter api is limited and we can't do a lot with it.
The following is a concept for the 2.0
version
From HTML to Markdown
$content = '<h1>Foo</h1>';
Interpreter::make($content)->fromHtml()->toMd();
// The toMd() can be used as toMarkdown() as well, as it will be aliased as it's now
> # Foo
From Markdown to HTML
$content = '# Foo';
Interpreter::make($content)->fromMd()->toHtml();
// The fromMd() can be used as fromMarkdown() as well, as it will be aliased as it's now
> <h1>Foo</h1>
From HTML to Textile
$content = '<h1>Foo</h1>';
Interpreter::make($content)->fromHtml()->toTextile();
> h1.Foo
From Textile to HTML
$content = 'h1.Foo';
Interpreter::make($content)->toTextile()->fromHtml();
> <h1>Foo</h1>
What's the state of support for CommonMark Spec?? http://commonmark.org/
@marcorivm it's definitely something i will consider.