Class: HtmlToProsemirror::Nodes::Heading
- Inherits:
-
Node
- Object
- Node
- HtmlToProsemirror::Nodes::Heading
show all
- Defined in:
- lib/html_to_prosemirror/nodes/heading.rb
Instance Attribute Summary
Attributes inherited from Node
#type, #wrapper
Instance Method Summary
collapse
Methods inherited from Node
#initialize
Instance Method Details
#data ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/html_to_prosemirror/nodes/heading.rb', line 9
def data
{
type: "heading",
attrs: {
level: get_level
}
}
end
|
#get_level ⇒ Object
18
19
20
21
22
23
24
|
# File 'lib/html_to_prosemirror/nodes/heading.rb', line 18
def get_level
matches = @node.name.scan(/^h([1-6])$/).first
if matches
return matches.first
end
return nil
end
|
#matching ⇒ Object
5
6
7
|
# File 'lib/html_to_prosemirror/nodes/heading.rb', line 5
def matching
!get_level.nil?
end
|