@@ -229,13 +229,13 @@ function traverseMdastNode(node, delta, attributes = {}) {
229
229
for ( const child of node . children || [ ] ) {
230
230
traverseMdastNode ( child , delta , listItemChildrenAttributes ) ;
231
231
}
232
-
232
+
233
233
// Attributes for the listItem's newline (e.g., { list: 'bullet', blockquote: true })
234
234
// are in `attributes` passed to this `listItem` case.
235
235
{
236
236
const lastOp = delta . ops [ delta . ops . length - 1 ] ;
237
237
if ( lastOp && lastOp . insert === "\n" ) {
238
- lastOp . attributes = { ...lastOp . attributes , ...attributes } ;
238
+ lastOp . attributes = { ...lastOp . attributes , ...attributes } ;
239
239
} else {
240
240
delta . ops . push ( { insert : "\n" , attributes } ) ;
241
241
}
@@ -249,18 +249,20 @@ function traverseMdastNode(node, delta, attributes = {}) {
249
249
}
250
250
break ;
251
251
252
- case "code" : { // mdast 'code' is a block
252
+ case "code" : {
253
+ // mdast 'code' is a block
253
254
const codeBlockLineFormat = { "code-block" : node . lang || true } ;
254
255
if ( attributes . blockquote ) {
255
256
codeBlockLineFormat . blockquote = true ;
256
257
}
257
258
258
259
const textInCodeAttributes = { } ;
259
- if ( attributes . blockquote ) { // Text lines also get blockquote if active
260
+ if ( attributes . blockquote ) {
261
+ // Text lines also get blockquote if active
260
262
textInCodeAttributes . blockquote = true ;
261
263
}
262
264
263
- const lines = ( node . value || "" ) . split ( '\n' ) ;
265
+ const lines = ( node . value || "" ) . split ( "\n" ) ;
264
266
for ( const lineText of lines ) {
265
267
delta . ops . push ( { insert : lineText , attributes : textInCodeAttributes } ) ;
266
268
delta . ops . push ( { insert : "\n" , attributes : codeBlockLineFormat } ) ;
@@ -269,7 +271,10 @@ function traverseMdastNode(node, delta, attributes = {}) {
269
271
}
270
272
271
273
case "inlineCode" :
272
- delta . ops . push ( { insert : node . value || "" , attributes : { ...attributes , code : true } } ) ;
274
+ delta . ops . push ( {
275
+ insert : node . value || "" ,
276
+ attributes : { ...attributes , code : true } ,
277
+ } ) ;
273
278
break ;
274
279
275
280
default :
@@ -302,7 +307,9 @@ function updateTextareaOnSubmit(form, textarea, quill) {
302
307
const delta = quill . getContents ( ) ;
303
308
const markdownContent = deltaToMarkdown ( delta ) ;
304
309
textarea . value = markdownContent ;
305
- console . log ( `${ textarea . name } :\n${ markdownContent } \ntransformed from delta:\n${ JSON . stringify ( delta , null , 2 ) } ` ) ;
310
+ console . log (
311
+ `${ textarea . name } :\n${ markdownContent } \ntransformed from delta:\n${ JSON . stringify ( delta , null , 2 ) } ` ,
312
+ ) ;
306
313
if ( textarea . required && ! markdownContent ) {
307
314
textarea . setCustomValidity ( `${ textarea . name } cannot be empty` ) ;
308
315
quill . once ( "text-change" , ( delta ) => {
@@ -456,7 +463,13 @@ function deltaToMdast(delta) {
456
463
}
457
464
458
465
// Process line break
459
- currentList = processLineBreak ( mdast , currentParagraph , attributes , textBuffer , currentList ) ;
466
+ currentList = processLineBreak (
467
+ mdast ,
468
+ currentParagraph ,
469
+ attributes ,
470
+ textBuffer ,
471
+ currentList ,
472
+ ) ;
460
473
461
474
currentParagraph = null ;
462
475
textBuffer = "" ;
0 commit comments