Quantcast
Channel: Live News for Yii Framework
Viewing all articles
Browse latest Browse all 3361

[extension] alcea/yii2-prism-syntax-highlighter

$
0
0

Latest Stable Version Total Downloads Latest Unstable Version License

YII2 Prism Syntax Highlighter

Prism is a lightweight, extensible syntax highlighter, built with modern web standards in mind. It’s used in thousands of websites, including some of those you visit daily.

How to install?

1. Use composer
composer require alcea/yii2-prism-syntax-highlighter "~1"
2. or, edit require section from composer.json
"alcea/yii2-prism-syntax-highlighter": "~1"
3. or, clone from GitHub
git clone https://github.com/alceanicu/yii2-prism-syntax-highlighter

How to use?

<?php

use alcea\yii2PrismSyntaxHighlighter\PrismSyntaxHighlighter;
 
PrismSyntaxHighlighter::widget([
    'theme' => PrismSyntaxHighlighter::THEME_DEFAULT,
    'languages' => ['php', 'php-extras', 'css'],
    'plugins' => ['copy-to-clipboard']
]);

$md = <<<MD_FILE
'''js
$(document).on('focusout', 'input[name="test"]', function(event) {
	event.preventDefault();
	// do ...
});
'''
MD_FILE;

echo Markdown::process($md, 'gfm-comment');
PrismJs page http://prismjs.com/download.html

Viewing all articles
Browse latest Browse all 3361

Trending Articles