prose_mirror_ruby 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/prose_mirror/serializers/markdown_serializer.rb +63 -0
- data/lib/prose_mirror/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d792aa0604c67f96703af60131fada1647f74382a17d0c475e1cb306146f42b6
|
4
|
+
data.tar.gz: 98d3f3d235042f89fd19dc28a73a41acf78634e77ce3e44ddb4b74ec58fbe8ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '08781c244f6fc5236fa6868de0ca801586c94018e4f253d64ccb006e4235550235f2a93f69d0a68969540367a7beea735c7fe6e3ed507e54bce8edb578ebdaf6'
|
7
|
+
data.tar.gz: 8a5ad08ec65b12dc88c11e5eb450ad296db82ecf94ee265e3bddeabf41812d08cc7850cdb3eab22386658da0c7d13202bf3f88c25986a8833b28da1cf8b08a8b
|
@@ -146,6 +146,62 @@ module ProseMirror
|
|
146
146
|
|
147
147
|
text: ->(state, node, parent = nil, index = nil) {
|
148
148
|
state.text(node.text, !state.in_autolink)
|
149
|
+
},
|
150
|
+
|
151
|
+
# Table serialization support
|
152
|
+
table: ->(state, node, parent = nil, index = nil) {
|
153
|
+
# Track that we're in a table
|
154
|
+
old_in_table = state.instance_variable_get(:@in_table) || false
|
155
|
+
state.instance_variable_set(:@in_table, true)
|
156
|
+
|
157
|
+
# Render table content
|
158
|
+
state.render_content(node)
|
159
|
+
|
160
|
+
# Restore table state
|
161
|
+
state.instance_variable_set(:@in_table, old_in_table)
|
162
|
+
|
163
|
+
# Only add newline if not at the end of the document
|
164
|
+
if parent && index < parent.child_count - 1
|
165
|
+
state.close_block(node)
|
166
|
+
end
|
167
|
+
},
|
168
|
+
|
169
|
+
table_row: ->(state, node, parent = nil, index = nil) {
|
170
|
+
# Write row separator after headers
|
171
|
+
if index == 1 && parent && parent.child(0).content.any? { |cell| cell.type.name == "table_header" }
|
172
|
+
state.write("|")
|
173
|
+
node.content.each do |_|
|
174
|
+
state.write(" --- |")
|
175
|
+
end
|
176
|
+
state.write("\n")
|
177
|
+
end
|
178
|
+
|
179
|
+
# Write row content
|
180
|
+
state.write("|")
|
181
|
+
state.render_content(node)
|
182
|
+
|
183
|
+
# Add newline unless this is the last row
|
184
|
+
if parent && index < parent.child_count - 1
|
185
|
+
state.write("\n")
|
186
|
+
end
|
187
|
+
},
|
188
|
+
|
189
|
+
table_header: ->(state, node, parent = nil, index = nil) {
|
190
|
+
state.write(" ")
|
191
|
+
# Render content with marks
|
192
|
+
node.content.each do |cell_content|
|
193
|
+
state.render_inline(cell_content)
|
194
|
+
end
|
195
|
+
state.write(" |")
|
196
|
+
},
|
197
|
+
|
198
|
+
table_cell: ->(state, node, parent = nil, index = nil) {
|
199
|
+
state.write(" ")
|
200
|
+
# Render content with marks
|
201
|
+
node.content.each do |cell_content|
|
202
|
+
state.render_inline(cell_content)
|
203
|
+
end
|
204
|
+
state.write(" |")
|
149
205
|
}
|
150
206
|
}
|
151
207
|
|
@@ -158,6 +214,13 @@ module ProseMirror
|
|
158
214
|
expel_enclosing_whitespace: true
|
159
215
|
},
|
160
216
|
|
217
|
+
italic: {
|
218
|
+
open: "*",
|
219
|
+
close: "*",
|
220
|
+
mixable: true,
|
221
|
+
expel_enclosing_whitespace: true
|
222
|
+
},
|
223
|
+
|
161
224
|
strong: {
|
162
225
|
open: "**",
|
163
226
|
close: "**",
|
data/lib/prose_mirror/version.rb
CHANGED