Module | YARD::Templates::Helpers::HtmlHelper
In: | lib/yard/templates/helpers/html_helper.rb

The helper module for HTML templates.

### Methods

anchor_for charset format_object_name_list format_types h html_markup_html html_markup_markdown html_markup_none html_markup_pre html_markup_rdoc html_markup_ruby html_markup_text html_markup_textile html_markup_textile_strict html_syntax_highlight html_syntax_highlight_plain htmlify htmlify_line link_file link_include_file link_include_object link_object link_url resolve_links signature signature_types url_for url_for_file urlencode

### Included Modules

MarkupHelper HtmlSyntaxHighlightHelper

### Public Instance methods

anchor_for(object)

@param [CodeObjects::Base] object the object to get an anchor for @return [String] the anchor for a specific object

charset()

Returns the current character set. The default value can be overridden by setting the `LANG` environment variable or by overriding this method. In Ruby 1.9 you can also modify this value by setting +Encoding.default_external+.

@return [String] the current character set @since 0.5.4

format_object_name_list(objects)

Formats a list of objects and links them @return [String] a formatted list of objects

format_types(typelist, brackets = true)

Formats a list of types from a tag.

@param [Array<String>, FalseClass] typelist

      the list of types to be formatted.

@param [Boolean] brackets omits the surrounding

      brackets if +brackets+ is set to +false+.

@return [String] the list of types formatted

      as [Type1, Type2, ...] with the types linked
      to their respective descriptions.

h(text)

Escapes HTML entities

@param [String] text the text to escape @return [String] the HTML with escaped entities

html_markup_html(text)

Converts HTML to HTML @param [String] text input html @return [String] output HTML @since 0.6.0

html_markup_markdown(text)

Converts Markdown to HTML @param [String] text input Markdown text @return [String] output HTML @since 0.6.0

html_markup_none(text)

@return [String] the same text with no markup @since 0.6.6

html_markup_pre(text)

Converts plaintext to pre-formatted HTML @param [String] text the input text @return [String] the output HTML @since 0.6.0

html_markup_rdoc(text)

Converts RDoc formatting (SimpleMarkup) to HTML @param [String] text the input RDoc formatted text @return [String] output HTML @since 0.6.0

html_markup_ruby(source)

Highlights Ruby source. Similar to {html_syntax_highlight}, but this method is meant to be called from {htmlify} when markup is set to "ruby".

@param [String] source the Ruby source @return [String] the highlighted HTML @since 0.7.0

html_markup_text(text)

Converts plaintext to regular HTML @param [String] text the input text @return [String] the output HTML @since 0.6.0

html_markup_textile(text)

Converts Textile to HTML @param [String] text the input Textile text @return [String] output HTML @since 0.6.0

html_markup_textile_strict(text)

Converts plaintext to strict Textile (hard breaks) @param [String] text the input textile data @return [String] the output HTML @since 0.6.0

html_syntax_highlight(source, type = nil)

Syntax highlights `source` in language `type`.

@note To support a specific language `type`, implement the method

      +html_syntax_highlight_TYPE+ in this class.

@param [String] source the source code to highlight @param [Symbol] type the language type (:ruby, :plain, etc). Use

      :plain for no syntax highlighting.

@return [String] the highlighted source

html_syntax_highlight_plain(source)

@return [String] unhighlighted source

htmlify(text, markup = options[:markup])

Turns text into HTML using `markup` style formatting.

@param [String] text the text to format @param [Symbol] markup examples are +:markdown+, +:textile+, +:rdoc+.

      To add a custom markup type, see {MarkupHelper}

@return [String] the HTML

htmlify_line(*args)

@return [String] HTMLified text as a single line (paragraphs removed)

link_file(filename, title = nil, anchor = nil)

(see BaseHelper#link_file)

link_include_file(file)

(see BaseHelper#link_include_file)

link_include_object(obj)

(see BaseHelper#link_include_object)

link_object(obj, otitle = nil, anchor = nil, relative = true)

(see BaseHelper#link_object)

link_url(url, title = nil, params = {})

(see BaseHelper#link_url)

resolve_links(text)

Resolves any text in the form of +{Name}+ to the object specified by Name. Also supports link titles in the form +{Name title}+.

@example Linking to an instance method

      resolve_links("{MyClass#method}") # => "<a href='...'>MyClass#method</a>"

@example Linking to a class with a title

      resolve_links("{A::B::C the C class}") # => "<a href='...'>the c class</a>"

@param [String] text the text to resolve links in @return [String] HTML with linkified references

signature(meth, link = true, show_extras = true, full_attr_name = true)

Formats the signature of method `meth`.

@param [CodeObjects::MethodObject] meth the method object to list

      the signature of

@param [Boolean] link whether to link the method signature to the details view @param [Boolean] show_extras whether to show extra meta-data (visibility, attribute info) @param [Boolean] full_attr_name whether to show the full attribute name

      ("name=" instead of "name")

@return [String] the formatted method signature

signature_types(meth, link = true)

Get the return types for a method signature.

@param [CodeObjects::MethodObject] meth the method object @param [Boolean] link whether to link the types @return [String] the signature types @since 0.5.3

url_for(obj, anchor = nil, relative = true)

Returns the URL for an object.

@param [String, CodeObjects::Base] obj the object (or object path) to link to @param [String] anchor the anchor to link to @param [Boolean] relative use a relative or absolute link @return [String] the URL location of the object

url_for_file(filename, anchor = nil)

Returns the URL for a specific file

@param [String, CodeObjects::ExtraFileObject] filename the filename to link to @param [String] anchor optional anchor @return [String] the URL pointing to the file

urlencode(text)

Escapes a URL

@param [String] text the URL @return [String] the escaped URL

[Validate]