Skip to content

Commit

Permalink
MDL-75963 filter: Added code highlighter filter
Browse files Browse the repository at this point in the history
If enabled, the filter will convert text wrapped by language-* style class
into a well-styled block of code.
The filter uses PrismJS, and it also used by the TinyMCE editor to
highlight the code sample plugin.
  • Loading branch information
meirzamoodle committed May 11, 2023
1 parent 5d320dd commit 6772c9b
Show file tree
Hide file tree
Showing 15 changed files with 3,553 additions and 1 deletion.
10 changes: 10 additions & 0 deletions filter/codehighlighter/amd/build/prism-init.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions filter/codehighlighter/amd/build/prism-init.min.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions filter/codehighlighter/amd/build/prism.min.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions filter/codehighlighter/amd/build/prism.min.js.map

Large diffs are not rendered by default.

25 changes: 25 additions & 0 deletions filter/codehighlighter/amd/src/prism-init.js
@@ -0,0 +1,25 @@
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.

/**
* Prism.js initialization.
*
* @module filter/codegihlighter
* @copyright 2023 Meirza <meirza.arson@moodle.com>
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
define(['./prism'], function(PrismJS) {
PrismJS.highlightAll();
});

0 comments on commit 6772c9b

Please sign in to comment.