PHP code example of laravelista / sherlock

1. Go to this page and download the library: Download laravelista/sherlock 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/ */

    

laravelista / sherlock example snippets


use Laravelista\Sherlock\Sherlock;

$sherlock = new Sherlock;

return $sherlock->deduct($markdown)->getToc();

use Laravelista\Sherlock\Sherlock;

$sherlock = new Sherlock;

return $sherlock->deduct($markdown)->get('Chapter 1');

$sherlock->deduct(string $content)

$sherlock->deduct($markdown)->get('Chapter 1')

$sherlock->deduct($markdown)->getLibrary()

[
    [
        'level' => 1,
        'name' => 'This is the document title',
        'starts_at' => 0,
        'ends_at' => 3,
        'slug' => 'this-is-the-document-title'
    ],
    [
        'level' => 2,
        'name' => 'Introduction',
        'starts_at' => 4,
        'ends_at' => 7,
        'slug' => 'introduction'
    ],
    [
        'level' => 3,
        'name' => 'Another introduction',
        'starts_at' => 8,
        'ends_at' => 11,
        'slug' => 'another-introduction'
    ],
    [
        'level' => 4,
        'name' => 'Deep introduction',
        'starts_at' => 12,
        'ends_at' => 19,
        'slug' => 'deep-introduction'
    ],
    [
        'level' => 2,
        'name' => 'Plot',
        'starts_at' => 20,
        'ends_at' => 23,
        'slug' => 'plot'
    ],
    [
        'level' => 2,
        'name' => 'Conclusion',
        'starts_at' => 24,
        'ends_at' => 27,
        'slug' => 'conclusion'
    ],
];
html
@inject('sherlock', 'Laravelista\Sherlock\Sherlock')
 $sherlock->deduct($lesson->content) 
html
{!! $sherlock->getToc() !!}