# Module: YARD::Templates::Helpers::HtmlSyntaxHighlightHelper

Includes:
  ModuleHelper

Included in:
  HtmlHelper

Defined in:
  lib/yard/templates/helpers/html_syntax_highlight_helper.rb

## Overview

Helper methods for syntax highlighting.

## Constant Summary collapse

ALREADY_HIGHLIGHTED_RE =

Matches source that has already been highlighted (i.e. contains a span tag). Used to avoid double-processing pre-highlighted HTML in the rescue clause of #html_syntax_highlight_ruby_ripper and in the YARD::Templates::Helpers::HtmlHelper#parse_codeblocks guard.

      /<span[\s>]/

## Instance Method Summary collapse

- #html_syntax_highlight_ruby(source) ⇒ String

  Highlights Ruby source.

### Methods included from ModuleHelper

#prune_method_listing

## Instance Method Details

### #html_syntax_highlight_ruby(source) ⇒ `String`

Highlights Ruby source

Parameters:

- source (`String`) —

  the Ruby source code

Returns:

- (`String`) —

  the highlighted Ruby source

    17
    18
    19
    20
    21
    22
    23

    # File 'lib/yard/templates/helpers/html_syntax_highlight_helper.rb', line 17

    def html_syntax_highlight_ruby(source)
      if Parser::SourceParser.parser_type == :ruby
        html_syntax_highlight_ruby_ripper(source)
      else
        html_syntax_highlight_ruby_legacy(source)
      end
    end