Class: TipTap::Nodes::TableRow
Instance Attribute Summary
#output_buffer
Attributes included from HasContent
#attrs, #content
Instance Method Summary
collapse
#to_plain_text
#include_empty_content_in_json?, #to_h
#html_attributes, #html_class_name, #html_tag, included, #inline_styles, #to_html
Methods included from HasContent
#add_content, #blank?, #each, #find_node, included, #initialize, #size
included, #type_name
Instance Method Details
#table_cell(&block) ⇒ Object
11
12
13
14
15
|
# File 'lib/tip_tap/nodes/table_row.rb', line 11
def table_cell(&block)
raise ArgumentError, "Block required" if block.nil?
add_content(TableCell.new(&block))
end
|
17
18
19
20
21
|
# File 'lib/tip_tap/nodes/table_row.rb', line 17
def (&block)
raise ArgumentError, "Block required" if block.nil?
add_content(TableHeader.new(&block))
end
|
#to_markdown(context = Markdown::Context.root) ⇒ Object
23
24
25
26
|
# File 'lib/tip_tap/nodes/table_row.rb', line 23
def to_markdown(context = Markdown::Context.root)
row_data = to_markdown_row(context)
"| #{row_data[:cells].join(" | ")} |"
end
|
#to_markdown_row(context) ⇒ Object
28
29
30
31
32
33
|
# File 'lib/tip_tap/nodes/table_row.rb', line 28
def to_markdown_row(context)
{
cells: content.map { |node| node.to_markdown(context) },
is_header: content.all? { |node| node.is_a?(TableHeader) }
}
end
|