Last active
November 29, 2019 07:00
-
-
Save harikt/7963895ee5e94fc1edf5deaeaa7ea778 to your computer and use it in GitHub Desktop.
PHP code highlighting not working for hugo
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```yaml | |
pygmentsuseclasses: false | |
pygmentsCodeFences: true | |
pygmentsCodeFencesGuessSyntax: true | |
markup: | |
highlight: | |
codeFences: true | |
hl_Lines: "" | |
lineNoStart: 1 | |
lineNos: true | |
lineNumbersInTable: true | |
noClasses: true | |
style: monokai | |
tabWidth: 4 | |
``` | |
PHP code is not highlighted. | |
```php | |
$hello = function () { | |
echo "Hello World"; | |
}; | |
``` | |
{{< highlight php >}} | |
$hello = function () { | |
echo "Hello World"; | |
}; | |
{{< /highlight >}} | |
But if we add a <?php in front it will convert to html inside span with color. All below code works. | |
``` | |
<?php | |
$hello = function () { | |
echo "Hello World"; | |
}; | |
``` | |
{{< highlight html >}} | |
<section id="main"> | |
<div> | |
<h1 id="title">{{ .Title }}</h1> | |
{{ range .Data.Pages }} | |
{{ .Render "summary"}} | |
{{ end }} | |
</div> | |
</section> | |
{{< /highlight >}} | |
{{< highlight php >}} | |
<section id="main"> | |
<div> | |
<h1 id="title"><?= $title ?></h1> | |
<?php $value = "Hello World"; ?> | |
</div> | |
</section> | |
{{< /highlight >}} | |
```html | |
<section id="main"> | |
<div> | |
<h1 id="title"><?= $title ?></h1> | |
<?php $value = "Hello World"; ?> | |
</div> | |
</section> | |
``` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment