You are here

public static function GeshiFilterProcess::overrideGeshiDefaults in GeSHi Filter for syntax highlighting 8

Same name and namespace in other branches
  1. 8.2 src/GeshiFilterProcess.php \Drupal\geshifilter\GeshiFilterProcess::overrideGeshiDefaults()

Helper function for overriding some GeSHi defaults.

Parameters

\Geshi $geshi: Geshi object.

string $langcode: The language.

2 calls to GeshiFilterProcess::overrideGeshiDefaults()
GeshiFilterCss::generateLanguagesCssRules in src/GeshiFilterCss.php
Helper function for generating the CSS rules.
GeshiFilterProcess::geshiProcess in src/GeshiFilterProcess.php
Geshifilter wrapper for GeSHi processing.

File

src/GeshiFilterProcess.php, line 135

Class

GeshiFilterProcess
Helpers functions related to processing the source code with geshi.

Namespace

Drupal\geshifilter

Code

public static function overrideGeshiDefaults(\Geshi &$geshi, $langcode) {
  $config = \Drupal::config('geshifilter.settings');

  // Override the some default GeSHi styles (e.g. GeSHi uses Courier by
  // default, which is ugly).
  $geshi
    ->set_line_style('font-family: monospace; font-weight: normal;', 'font-family: monospace; font-weight: bold; font-style: italic;');
  $geshi
    ->set_code_style('font-family: monospace; font-weight: normal; font-style: normal');

  // Overall class needed for CSS.
  $geshi
    ->set_overall_class('geshifilter-' . $langcode);

  // Set keyword linking.
  $geshi
    ->enable_keyword_links($config
    ->get('enable_keyword_urls', TRUE));
}