andrew72ru / yii2-typographer
Typographer for Yii2 based on Evgeny Muravjev Typograph, http://mdash.ru
Installs: 316
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- kix/mdash: 0.5.x
- michelf/php-markdown: *
- yiisoft/yii2: *
This package is auto-updated.
Last update: 2024-10-23 02:29:38 UTC
README
Typographer based on Evgeny Muravjev Typograph, http://mdash.ru
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist andrew72ru/yii2-typographer "dev-master"
or add
"andrew72ru/yii2-typographer": "dev-master"
to the require section of your composer.json
file.
Setup
Set up you application components:
'components' => [ … 'typographer' => [ 'class' => 'andrew72ru\typographer\Typographer', 'params' => [ 'Text.paragraphs' => 'off', 'Text.breakline' => 'off', 'OptAlign.oa_oquote' => 'on', 'OptAlign.oa_obracket_coma' => 'on', 'OptAlign.oa_oquote_extra' => 'on', 'Number.math_chars' => 'on', // Other parametrs – see http://mdash.ru ], 'markdown' => true, // Whether to use yii\helpers\Markdown to convert text 'markdownType' => 'gfm' // what type of markdown use in converter ] ]
Usage
If your text is in paragraph, and you don’t need to convert this to other paragraphs:
<p class="lead"><?= Yii::$app->typographer->directTypo($text)?></p>
If your text with \n or markdown text
<?= Yii::$app->typographer->typo($text) ?>