/**
  * Gets a template file content
  *
  * @param string $template_path
  *
  * @return mixed|string
  *
  * @throws \MarkdownExtended\Exception\FileSystemException if the template can not be found or is not readable
  */
 public function getTemplate($template_path)
 {
     if (true === $template_path) {
         $template_path = Kernel::getConfig('output_format_options.' . Kernel::getConfig('output_format') . '.default_template');
         if (empty($template_path)) {
             return Kernel::getConfig('template_options.inline_template');
         }
     }
     if (!file_exists($template_path)) {
         $local_path = Kernel::getResourcePath($template_path, Kernel::RESOURCE_TEMPLATE);
         if (empty($local_path) || !file_exists($local_path)) {
             throw new FileSystemException(sprintf('Template "%s" not found', $template_path));
         }
         $template_path = $local_path;
     }
     if (!$this->cache->isCached($template_path)) {
         if (!is_readable($template_path)) {
             throw new FileSystemException(sprintf('Template "%s" is not readable', $template_path));
         }
         $tpl_content = Helper::readFile($template_path);
         $this->cache->setCache($template_path, $tpl_content);
     } else {
         $tpl_content = $this->cache->getCache($template_path);
     }
     return $tpl_content;
 }
 /**
  * Defines custom options or configuration file
  *
  * @param string|array $options A set of options or a configuration file path to override defaults
  *
  * @return $this
  *
  * @throws \MarkdownExtended\Exception\FileSystemException if a configuration file can not be found
  */
 public function setOptions($options)
 {
     if (is_string($options)) {
         return $this->setOptions(array('config_file' => $options));
     }
     if (isset($options['config_file']) && !empty($options['config_file'])) {
         $path = $options['config_file'];
         unset($options['config_file']);
         if (!file_exists($path)) {
             $local_path = Kernel::getResourcePath($path, Kernel::RESOURCE_CONFIG);
             if (empty($local_path) || !file_exists($local_path)) {
                 throw new FileSystemException(sprintf('Configuration file "%s" not found', $path));
             }
             $path = $local_path;
         }
         $path_options = $this->loadConfigFile($path);
         unset($path_options['config_file']);
         $this->setOptions($path_options);
         $options['loaded_config_file'] = $path;
     }
     if (is_array($options) && !empty($options)) {
         foreach ($options as $var => $val) {
             $this->getKernel()->setConfig($var, $val);
         }
     }
     return $this;
 }