PHP code example of ueberdosis / pandoc

1. Go to this page and download the library: Download ueberdosis/pandoc library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

ueberdosis / pandoc example snippets


$output = (new \Pandoc\Pandoc)
    ->from('markdown')
    ->input('# Test')
    ->to('html')
    ->run();

(new \Pandoc\Pandoc)
    ->from('markdown')
    ->inputFile('tests/data/example.md')
    ->to('plain')
    ->output('tests/temp/example.txt')
    ->run();

new \Pandoc\Pandoc([
    'command' => '/usr/local/bin/pandoc',
]);

(new \Pandoc\Pandoc)->cwd('/tmp/pandoc/');

(new \Pandoc\Pandoc)->listInputFormats();

(new \Pandoc\Pandoc)->listOutputFormats();

echo (new \Pandoc\Pandoc)
    ->from('markdown')
    ->input('# Markdown')
    ->to('html')
    ->log('log.txt')
    ->run();

echo (new \Pandoc\Pandoc)->version();

$output = (new \Pandoc\Pandoc)
    ->fromMarkdown('# Test')
    ->toHtml('tests/temp/example.txt')
    ->run();

echo (new \Pandoc\Pandoc)
    ->fromMarkdown('# Test')
    ->toHtml('tests/temp/example.txt')
    ->option('fail-if-warnings')
    ->option('data-dir', './tmp')
    ->run();

echo \Pandoc\Facades\Pandoc::version();