Skip to content

Commit

Permalink
Merge branch 'release/1.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
rhukster committed Apr 17, 2019
2 parents 6479620 + affebc7 commit ae8ffb9
Show file tree
Hide file tree
Showing 4 changed files with 114 additions and 36 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# v1.0.0
## mm/dd/2019
## 04/16/2019

1. [](#new)
* Initial Version
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2019 Grav, PrismJS
Copyright (c) 2019 Trilby Media, PrismJS

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
88 changes: 61 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ You should now have all the plugin files under

# Languages included

Prism.js supports currently [176 languages](http://prismjs.com/#languages-list), at the time of this edit, but the ones included in this specific version is:
Prism.js supports currently [176 languages](http://prismjs.com/#languages-list), at the time of this edit, but the ones included in this specific version are:

* markup
* html
Expand Down Expand Up @@ -75,31 +75,31 @@ This build of Prism also includes the following plugins:

In your markdown, you can create a block of code, and assign the language to it. You can choose between the list above. Example:

```
```php
<?php
namespace Grav\Plugin;
use \Grav\Common\Plugin;
use \Grav\Common\Grav;
use \Grav\Common\Page\Page;
class PrismHighlightPlugin extends Plugin
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'onPageInitialized' => ['onPageInitialized', 0],
'onShortcodeHandlers' => ['onShortcodeHandlers', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
];
}
}
```
```php
<?php

namespace Grav\Plugin;

use \Grav\Common\Plugin;
use \Grav\Common\Grav;
use \Grav\Common\Page\Page;

class PrismHighlightPlugin extends Plugin
{
/**
* @return array
*/
public static function getSubscribedEvents()
{
return [
'onPageInitialized' => ['onPageInitialized', 0],
'onShortcodeHandlers' => ['onShortcodeHandlers', 0],
'onTwigTemplatePaths' => ['onTwigTemplatePaths', 0],
];
}
}
```
```
# Advanced Usage
Expand All @@ -113,14 +113,35 @@ To get access to advanced options that can be set individually, you can use the
[/prism]
```
for line numbers, or:
```
[prism classes="language-bash command-line" cl-prompt="\[foo@localhost\] $"]
cd ~/webroot
git clone -b master https://github.com/getgrav/grav.git
[/prism]
```
... more to come ...
for a command prompt, or:
```
[prism classes="language-yaml" highlight="2,4"]
enabled: true
theme: prism-base16-ocean.dark.css
all-pre-blocks: true
plugins:
line-numbers: false
command-line: false
command-line-prompt: '$'
[/prism]
```
to highlight lines 2 and 4.
Find out more about these options by checking out the [Prism.js plugins page](https://prismjs.com/#plugins).
# Configuration
Expand All @@ -136,7 +157,20 @@ plugins:
command-line-prompt: '$'
```

You can also override the default theme for a page with the option `theme`:
You can also override configuration settings at the page level by prefixing options with `prism-highlight:`. For example you could set a different theme, and turning on line numbers on a particular page with:

```yaml
title: My Page
prism-highlight:
theme: base16-duotone-dark.light.css
plugins:
line-numbers: true
```
### Themes
The themes available are:
```
base16-duotone-dark.dark.css
Expand Down
58 changes: 51 additions & 7 deletions blueprints.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Prism Highlighter
version: 1.0.0
description: "This plugin provides code highlighting functionality via the [Prism.js](http://prismjs.com/) syntax highlighter."
description: "This plugin provides code highlighting functionality via the [Prism.js](http://prismjs.com/) syntax highlighter with lots of themes and plugins."
icon: code
author:
name: Team Grav
email: [email protected]
url: http://getgrav.org
homepage: https://github.com/getgrav/grav-prism-highlight
keywords: highlight, plugin, code, prism
bugs: https://github.com/getgrav/grav-prism-highlight/issues
name: Trilby Media
email: [email protected]
url: https://trilby.media
homepage: https://github.com/trilbymedia/grav-prism-highlight
keywords: highlight, plugin, code, prism.js
bugs: https://github.com/trilbymedia/grav-prism-highlight/issues
license: MIT

form:
Expand All @@ -32,4 +32,48 @@ form:
size: large
data-options@: '\Grav\Plugin\PrismHighlightPlugin::themeOptions'

all-pre-blocks:
type: toggle
label: All Pre Blocks
highlight: 1
default: 1
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool

section_plugins:
type: section
title: Plugins Options
underline: true

plugins.line-numbers:
type: toggle
label: Line Numbers
highlight: 0
default: 0
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool

plugins.command-line:
type: toggle
label: Command Line
highlight: 0
default: 0
options:
1: PLUGIN_ADMIN.ENABLED
0: PLUGIN_ADMIN.DISABLED
validate:
type: bool

plugins.command-line-prompt:
type: text
size: small
label: Command Line Prompt



0 comments on commit ae8ffb9

Please sign in to comment.