Skip to content

Commit 12de02f

Browse files
authored
Update README.md
Add syntax highlighting to code snippets
1 parent c1be75e commit 12de02f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,23 @@ Laravel Handlebars is distributed as a composer package. So you first have to ad
1212

1313
- For Laravel 5.5 and up:
1414

15-
```
15+
```json
1616
"proai/laravel-handlebars": "^1.6"
1717
```
1818

1919
- For Laravel 5.1 to 5.4:
2020

21-
```
21+
```json
2222
"proai/laravel-handlebars": "~1.5.0"
2323
```
2424

2525
Then you have to run `composer update` to install the package. Once this is completed, you have to add the service provider to the providers array in `config/app.php`:
2626

27-
```
28-
/*
29-
* Package Service Providers...
30-
*/
31-
ProAI\Handlebars\HandlebarsServiceProvider::class,
27+
```php
28+
/*
29+
* Package Service Providers...
30+
*/
31+
ProAI\Handlebars\HandlebarsServiceProvider::class,
3232
```
3333

3434
You can publish the package configuration with the following command:
@@ -57,12 +57,12 @@ By default all views which have a `.hbs` or `.handlebars` file extension are aut
5757

5858
If you wish, you can use the Blade language directives `@lang` and `@choice` in Handlebars templates, too. You have to set `$language_helpers = true` in order to use them. Here is an example:
5959

60-
```
60+
```php
6161
// Blade syntax:
6262
@lang('message', ['firstname' => 'John', 'lastname' => $lastname])
6363
@choice('comment_count', 2, ['item' => 'Article'])
6464
```
65-
```
65+
```handlebars
6666
// Handlebars syntax:
6767
{{lang 'message' firstname='John' lastname=lastname }}
6868
{{choice 'comment_count' 2 item='Article' }}
@@ -74,12 +74,12 @@ _This feature is currently broken. If you want to use it, use v1.1 or below or [
7474

7575
If you want to output the raw code of a template (maybe because you want to use the unrendered template clientside), you can set `$optional_raw_output = true` in the configuration. Then you can pass a variable `$raw = true` to the template or more comfortable you can use the `@raw` Blade directive.
7676

77-
```
77+
```php
7878
// Passing the $raw variable to the view:
7979
View::make('articles', ['raw' => true])
8080
@include('articles', ['raw' => true])
8181
```
82-
```
82+
```php
8383
// Blade @raw directive:
8484
@raw('articles')
8585
```
@@ -92,7 +92,7 @@ This package automatically adds the directory of the current template to the bas
9292

9393
### Example Template
9494

95-
```
95+
```handlebars
9696
{{#each array_variable }}
9797
{{#if this }}
9898
{{ output_some_variable }} {{> include_templatename }}

0 commit comments

Comments
 (0)