Skip to content

Commit

Permalink
Merge pull request #2 from ARCANEDEV/feature-laravel_53
Browse files Browse the repository at this point in the history
Adding Laravel 5.3 Support
  • Loading branch information
arcanedev-maroc authored Sep 5, 2016
2 parents 4cf1e8c + 3900dce commit fb455c5
Show file tree
Hide file tree
Showing 12 changed files with 41 additions and 47 deletions.
10 changes: 4 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
.idea/
_arcanedev/
build/
vendor/
composer.phar
composer.lock
/build/
/vendor/
/composer.phar
/composer.lock
4 changes: 2 additions & 2 deletions .scrutinizer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ checks:

tools:
external_code_coverage:
timeout: 800
runs: 8
timeout: 900
runs: 9
php_code_sniffer:
enabled: true
config:
Expand Down
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ language: php
sudo: false

php:
- 5.5.9
- 5.5
- 5.6
- 7.0
- 7.1
- nightly
- hhvm

Expand All @@ -17,6 +16,7 @@ matrix:
env:
- TESTBENCH_VERSION=3.1.*
- TESTBENCH_VERSION=3.2.*
- TESTBENCH_VERSION=3.3.*

before_script:
- travis_retry composer self-update
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/LaravelMarkdo

### Features

* Laravel 5.1 & 5.2 are Supported.
* Laravel `5.1 | 5.2 | 5.3` are Supported.
* Easy setup & configuration.
* Well tested (100% code coverage with maximum code quality).
* Made with :heart: & :coffee:.

## Table of contents

1. [Requirements](_docs/1-Requirements.md)
2. [Installation and Setup](_docs/2-Installation-and-Setup.md)
3. [Configuration](_docs/3-Configuration.md)
4. [Usage](_docs/4-Usage.md)
1. [Requirements](1-Requirements.md)
2. [Installation and Setup](2-Installation-and-Setup.md)
3. [Configuration](3-Configuration.md)
4. [Usage](4-Usage.md)

## Contribution

Expand All @@ -47,7 +47,7 @@ If you discover any security related issues, please email arcanedev.maroc@gmail.
- [All Contributors][link-contributors]

[badge_license]: https://img.shields.io/packagist/l/arcanedev/laravel-markdown.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/For-Laravel%205.1|5.2-orange.svg?style=flat-square
[badge_laravel]: https://img.shields.io/badge/Laravel-%205.1|5.2|5.3-orange.svg?style=flat-square
[badge_build]: https://img.shields.io/travis/ARCANEDEV/LaravelMarkdown.svg?style=flat-square
[badge_hhvm]: https://img.shields.io/hhvm/arcanedev/laravel-markdown.svg?style=flat-square
[badge_coverage]: https://img.shields.io/scrutinizer/coverage/g/ARCANEDEV/LaravelMarkdown.svg?style=flat-square
Expand Down
10 changes: 5 additions & 5 deletions _docs/0-Home.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ Feel free to check out the [releases](https://github.com/ARCANEDEV/LaravelMarkdo

### Features

* Laravel 5.1 & 5.2 are Supported.
* Laravel `5.1 | 5.2 | 5.3` are Supported.
* Easy setup & configuration.
* Well tested (100% code coverage with maximum code quality).
* Made with :heart: & :coffee:.

## Table of contents

1. [Requirements](1-Requirements.md)
2. [Installation and Setup](2-Installation-and-Setup.md)
3. [Configuration](3-Configuration.md)
4. [Usage](4-Usage.md)
1. [Requirements](1-Requirements.md)
2. [Installation and Setup](2-Installation-and-Setup.md)
3. [Configuration](3-Configuration.md)
4. [Usage](4-Usage.md)
3 changes: 1 addition & 2 deletions _docs/1-Requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

The Laravel Markdown package has a few system requirements:

- PHP >= 5.5.9
- Laravel 5.1 or 5.2
- PHP >= 5.6
16 changes: 8 additions & 8 deletions _docs/4-Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,29 @@

## Table of contents

* [Blade](#blade)
* [Helper](#helper)
* [Facade](#facade)
* [Service Container](#service-container)
* [Blade](#blade)
* [Helper](#helper)
* [Facade](#facade)
* [Service Container](#service-container)

### Blade

The Markdown parser can be used in your Blade files with the `@markdown` directive:
The Markdown parser can be used in your Blade files with the `@parsedown` directive:

```html
<article>
<h1 class="page-header">{{ $post->title }}</h1>

<section class="content">
@markdown($post->content)
@parsedown($post->content)
</section>
</article>
```

You can also use it as `@section` blocks syntax:
You can also use the `@markdown()` blade directive as the `@section` blocks syntax:

```markdown
@markdown
@markdown()
# My awesome header

This text is *italic* but this one is **bold**, you can also add a [Link](http://www.example.com).
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"type": "library",
"license": "MIT",
"require": {
"php": ">=5.5.9",
"php": ">=5.6",
"arcanedev/support": "~3.0",
"erusev/parsedown": "~1.6"
},
Expand Down
4 changes: 3 additions & 1 deletion helpers.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

use Arcanedev\LaravelMarkdown\Contracts\Parser;

if ( ! function_exists('markdown')) {
/**
* Helper function to parse a markdown string to HTML or return the parser instance if the content is null.
Expand All @@ -9,7 +11,7 @@
* @return \Arcanedev\LaravelMarkdown\Contracts\Parser|string
*/
function markdown($content = null) {
$markdown = app('arcanedev.markdown');
$markdown = app(Parser::class);

return is_null($content) ? $markdown : $markdown->parse($content);
}
Expand Down
19 changes: 7 additions & 12 deletions src/LaravelMarkdownServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,6 @@ class LaravelMarkdownServiceProvider extends PackageServiceProvider
| Properties
| ------------------------------------------------------------------------------------------------
*/
/**
* Vendor name.
*
* @var string
*/
protected $vendor = 'arcanedev';

/**
* Package name.
*
Expand Down Expand Up @@ -105,14 +98,16 @@ private function registerBladeDirectives()
/** @var \Illuminate\View\Compilers\BladeCompiler $blade */
$blade = $this->app['view']->getEngineResolver()->resolve('blade')->getCompiler();

$blade->directive('markdown', function ($markdown) {
return is_null($markdown)
? '<?php markdown()->begin() ?>'
: "<?php echo markdown()->parse($markdown); ?>";
$blade->directive('parsedown', function ($markdown) {
return "<?php echo markdown()->parse($markdown); ?>";
});

$blade->directive('markdown', function () {
return '<?php markdown()->begin(); ?>';
});

$blade->directive('endmarkdown', function () {
return '<?php echo markdown()->end() ?>';
return '<?php echo markdown()->end(); ?>';
});
}
}
2 changes: 1 addition & 1 deletion src/MarkdownParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public function __construct(Parsedown $parser)
/**
* Parses a markdown string to HTML.
*
* @param string $content
* @param string $content
*
* @return string
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/fixtures/views/blade-directive-one.blade.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
@markdown('# Hello')
@parsedown('# Hello')

0 comments on commit fb455c5

Please sign in to comment.