Skip to content

Instantly share code, notes, and snippets.

@ryangjchandler

ryangjchandler/README.md Secret

Last active Jan 13, 2021
Embed
What would you like to do?
`highlight.php` Laravel Blade Support
  1. Copy the contents of the blade.json file into a new resources/syntax/blade.json file, or wherever you want to place it.

  2. Add the following code snippet into your application before using highlight.php:

\Highlight\Highlighter::registerLanguage('blade', resource_path('syntax/blade.json'), true);

You should change the 2nd argument according to where you created your blade.json file.

{
"case_insensitive": true,
"subLanguage": "xml",
"contains": [
{
"className": "comment",
"begin": "\\{\\{--",
"end": "--\\}\\}"
},
{
"className": "template-variable",
"begin": "\\{\\{",
"starts": {
"end": "\\}\\}",
"returnEnd": true,
"subLanguage": "php"
}
},
{
"className": "template-variable",
"begin": "\\}\\}"
},
{
"className": "template-variable",
"begin": "\\{!!",
"starts": {
"end": "!!\\}",
"returnEnd": true,
"subLanguage": "php"
}
},
{
"className": "template-variable",
"begin": "!!\\}"
},
{
"className": "template-tag",
"begin": "@php",
"starts": {
"end": "@endphp",
"returnEnd": true,
"subLanguage": "php"
},
"relevance": 10
},
{
"begin": "@[\\w]+",
"end": "[\\W]",
"excludeEnd": true,
"className": "template-tag"
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.