PHP code example of ubertech-za / tiptap-to-asciidoc

1. Go to this page and download the library: Download ubertech-za/tiptap-to-asciidoc 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/ */

    

ubertech-za / tiptap-to-asciidoc example snippets


use UbertechZa\TipTapToAsciiDoc\TipTapConverter;

$converter = new TipTapConverter();

$tipTapJson = [
    'type' => 'doc',
    'content' => [
        [
            'type' => 'heading',
            'attrs' => ['level' => 1],
            'content' => [
                ['type' => 'text', 'text' => 'Welcome to AsciiDoc']
            ]
        ],
        [
            'type' => 'paragraph',
            'content' => [
                ['type' => 'text', 'text' => 'This is a '],
                ['type' => 'text', 'text' => 'bold', 'marks' => [['type' => 'bold']]],
                ['type' => 'text', 'text' => ' statement with a '],
                ['type' => 'text', 'text' => 'link', 'marks' => [['type' => 'link', 'attrs' => ['href' => 'https://asciidoc.org']]]],
                ['type' => 'text', 'text' => '.']
            ]
        ]
    ]
];

$asciidoc = $converter->convert($tipTapJson);
echo $asciidoc;
bash
composer analyse