Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Moving markdown function to a helpers file #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions app/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

use League\CommonMark\Converter;
use League\CommonMark\DocParser;
use League\CommonMark\Environment;
use League\CommonMark\HtmlRenderer;
use Webuni\CommonMark\TableExtension\TableExtension;

/**
* Convert some text to Markdown...
*/
if (!function_exists('markdown')) {
function markdown($text)
{
$environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new TableExtension());

$converter = new Converter(new DocParser($environment), new HtmlRenderer($environment));

return $converter->convertToHtml($text);
}
}
9 changes: 6 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@
],
"psr-4": {
"App\\": "app/"
}
},
"files": [
"app/helpers.php"
]
},
"autoload-dev": {
"classmap": [
Expand All @@ -46,7 +49,7 @@
]
}
},

"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
Expand All @@ -57,7 +60,7 @@
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
],
],
"post-install-cmd": [
"Illuminate\\Foundation\\ComposerScripts::postInstall"
],
Expand Down
21 changes: 1 addition & 20 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,28 +10,9 @@
| contains the "web" middleware group. Now create something great!
|
*/
use League\CommonMark\Converter;
use League\CommonMark\DocParser;
use League\CommonMark\Environment;
use League\CommonMark\HtmlRenderer;
use Webuni\CommonMark\TableExtension\TableExtension;

/**
* Convert some text to Markdown...
*/
if (!function_exists('markdown')) {
function markdown($text)
{
$environment = Environment::createCommonMarkEnvironment();
$environment->addExtension(new TableExtension());

$converter = new Converter(new DocParser($environment), new HtmlRenderer($environment));

return $converter->convertToHtml($text);
}
}
Route::get('/', 'DocumentationController@landing');
Route::get('/imprint', function(){
Route::get('/imprint', function () {
return view('imprint')->with('title', 'Imprint');
});

Expand Down
Empty file modified storage/logs/.gitignore
100644 → 100755
Empty file.