Sha256: 64a6bf5557317c94851d3dbf08a317865a3f9b65eb841b2d689c82ab27a8a53d
Contents?: true
Size: 1.32 KB
Versions: 2
Compression:
Stored size: 1.32 KB
Contents
# frozen_string_literal: true require 'jekyll' require 'jekyll-katex/lib_root' module Jekyll module Katex # For holding configuration values specific to the jekyll-katex plugin class Configuration LOG_TOPIC = 'Katex Configuration:' CONFIG_DEFAULTS = { js_filename: 'katex.min.js', js_path: File.join(Jekyll::Katex::LIB_ROOT, 'assets', 'js'), rendering_options: { throw_error: true, error_color: '#cc0000' } }.freeze JEKYLL_CONFIG = Jekyll.configuration['katex'] || {} def self.js_path js_filename = JEKYLL_CONFIG['js_filename'] || CONFIG_DEFAULTS[:js_filename] js_path = JEKYLL_CONFIG['js_path'] || CONFIG_DEFAULTS[:js_path] katex_js = Dir.glob(File.join(js_path, '**', js_filename)).first raise 'Could not find KaTeX javascript file using provided configuration.' if katex_js.nil? Jekyll.logger.info LOG_TOPIC, "Found KaTeX js at: #{katex_js}" katex_js end def self.global_rendering_options { throwOnError: JEKYLL_CONFIG['rendering_options']['throw_error'] || CONFIG_DEFAULTS[:rendering_options][:throw_error], errorColor: JEKYLL_CONFIG['rendering_options']['error_color'] || CONFIG_DEFAULTS[:rendering_options][:error_color] } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
jekyll-katex-0.4.0 | lib/jekyll-katex/configuration.rb |
jekyll-katex-0.3.1 | lib/jekyll-katex/configuration.rb |