-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconfig.dist.php
More file actions
51 lines (41 loc) · 1.92 KB
/
config.dist.php
File metadata and controls
51 lines (41 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
/**
* Unscrew configuration file;
* Configure and rename this file to config.php;
*/
use League\Flysystem\Filesystem;
use Unscrew\Parser\DefaultParser;
use Unscrew\DefaultDocumentIdGenerator;
use League\CommonMark\MarkdownConverter;
use League\CommonMark\Environment\Environment;
use League\Flysystem\Local\LocalFilesystemAdapter;
use Symfony\Component\String\Slugger\AsciiSlugger;
use League\CommonMark\Extension\Table\TableExtension;
use League\CommonMark\Extension\Autolink\AutolinkExtension;
use League\CommonMark\Extension\TaskList\TaskListExtension;
use League\CommonMark\Extension\GithubFlavoredMarkdownExtension;
use League\CommonMark\Extension\FrontMatter\FrontMatterExtension;
use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
// Configure the Environment with all the CommonMark and GFM parsers/renderers
$environment = new Environment([]);
$environment->addExtension(new TableExtension());
$environment->addExtension(new TaskListExtension());
$environment->addExtension(new AutolinkExtension());
$environment->addExtension(new CommonMarkCoreExtension());
$environment->addExtension(new GithubFlavoredMarkdownExtension());
$environment->addExtension(new FrontMatterExtension());
$converter = new MarkdownConverter($environment);
// Filesystem adapter
$adapter = new LocalFilesystemAdapter(__DIR__ . '/storage');
return [
// Default format, when no file format is specified (json|html)
'defaultFormat' => \Unscrew\Unscrew::FORMAT_JSON,
// Filesystem to serve
'filesystem' => new Filesystem($adapter),
// The parser to use to transform from Markdown to JSON;
'parserToJson' => new DefaultParser($converter),
// Parser for transforming Markdown to HTML (optional)
'parserToHtml' => $converter,
// Helper for identifying documents (optional)
'documentIdGenerator' => new DefaultDocumentIdGenerator(new AsciiSlugger(), ''),
];