instance method format_list_item

Ruby on Rails edge

Since edge Private — implementation detail, not part of the public API

Signature

format_list_item(lines, bullet)

A list item’s later lines have to be indented to the width of its marker. Indent them less and the item ends there, which for a fenced code block means the fence closes early and the rest of the pre content #markdown_for_node emits unescaped is released as Markdown source. ‘- ` happens to be as wide as LIST_INDENT; `1. ` is not.

Parameters

lines req
bullet req
Source
# File actiontext/lib/action_text/markdown_conversion.rb, line 329
      def format_list_item(lines, bullet)
        first, *rest = lines
        leader = first.match?(LIST_BULLET) ? LIST_INDENT : bullet
        indent = " " * leader.length
        ([ leader + first ] + rest.map { |line| indent + line }).join("\n")
      end

Defined in actiontext/lib/action_text/markdown_conversion.rb line 329 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActionText::MarkdownConversion

Type at least 2 characters to search.

Use the arrow keys to navigate results, Enter to open one, Escape to close.

Keyboard shortcuts

/
Focus search
⌘K / Ctrl-K
Command palette
?
This help
Esc
Close