Skip to content

Commit

Permalink
Updated hljs and added support for live preview
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshyPHP committed Jan 21, 2020
1 parent eae6e4d commit eb604b7
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 10 deletions.
5 changes: 3 additions & 2 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.gitattributes export-ignore
README.md export-ignore
/.gitattributes export-ignore
/README.md export-ignore
/versions.json export-ignore
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) 2015-2019 The s9e Authors
Copyright (c) 2015-2020 The s9e authors

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
s9e/highlighter is a phpBB 3.2 extension that adds syntax highlighting to code blocks using [highlight.js](https://highlightjs.org/).
s9e/highlighter is a phpBB 3.3 extension that adds syntax highlighting to code blocks using [highlight.js](https://highlightjs.org/).

### How to install

Expand Down
12 changes: 8 additions & 4 deletions s9e/highlighter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,23 @@
"type": "phpbb-extension",
"description": "Adds syntax highlighting to code blocks using highlight.js",
"homepage": "https://github.com/s9e/phpbb-ext-highlighter/",
"version": "1.5.0",
"version": "2.0.0",
"keywords": ["phpbb","code","syntax","highlighting","highlighter"],
"license": "MIT",
"require": {
"php": ">=5.3.3",
"composer/installers": "~1.0"
"php": ">=7.1.0"
},
"authors": [{ "name": "JoshyPHP" }],
"extra": {
"installer-name": "highlighter",
"display-name": "s9e/highlighter",
"soft-require": {
"phpbb/phpbb": "3.2.*"
"phpbb/phpbb": "3.3.*"
},
"version-check": {
"host": "raw.githubusercontent.com",
"directory": "/s9e/phpbb-ext-highlighter/master",
"filename": "versions.json"
}
}
}
7 changes: 6 additions & 1 deletion s9e/highlighter/listener.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

/**
* @package s9e\highlighter
* @copyright Copyright (c) 2015-2019 The s9e Authors
* @copyright Copyright (c) 2015-2020 The s9e authors
* @license http://www.opensource.org/licenses/mit-license.php The MIT License
*/
namespace s9e\highlighter;
Expand Down Expand Up @@ -48,6 +48,11 @@ public function onConfigure($event)
{
$code->setAttribute('class', trim($code->getAttribute('class') . ' language-{@lang}'));
}
foreach ($dom->getElementsByTagName('pre') as $pre)
{
$pre->setAttribute('data-s9e-livepreview-hash', '');
$pre->setAttribute('data-s9e-livepreview-onupdate', "if(typeof hljsLoader!=='undefined')hljsLoader.highlightBlocks(this)");
}
$dom->saveChanges();
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<script async src="https://cdn.jsdelivr.net/gh/s9e/[email protected].2/loader.min.js" crossorigin="anonymous" integrity="sha384-Ddg1fxbyJ8jopcP7ywkmYwolvbUySxraRPtCH5F8EHy4p36EZwjDij+qDtypJV5Y" data-hljs-style="github-gist"></script>
<script async src="https://cdn.jsdelivr.net/gh/s9e/[email protected].6/loader.min.js" crossorigin="anonymous" integrity="sha384-zmUXofHyFIwgOUqZ7LgJySh3+QxRXTN5r9PV86t5Wu1m8yixc2x3UyDkFTmKH5L1" data-hljs-style="github-gist"></script>
1 change: 1 addition & 0 deletions versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"stable":{"2.0.0":{"current":"2.0.0","announcement":"https:\/\/github.com\/s9e\/phpbb-ext-highlighter","download":"https:\/\/github.com\/s9e\/phpbb-ext-highlighter\/archive\/2.0.0.zip","eol":null,"security":false}}}

0 comments on commit eb604b7

Please sign in to comment.