Skip to content

Commit

Permalink
Update block transform to escape/unescape
Browse files Browse the repository at this point in the history
  • Loading branch information
renatho committed Mar 8, 2021
1 parent 1cccee4 commit 28945a4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/code-block/transforms.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { createBlock } from '@wordpress/blocks';
import { escapeHTML } from '@wordpress/escape-html';
import unescape from 'lodash.unescape';

export default {
from: [
Expand Down Expand Up @@ -35,7 +37,7 @@ export default {
type: 'block',
blocks: [ 'core/code' ],
transform: ( { content } ) => {
return createBlock( 'syntaxhighlighter/code', { content } );
return createBlock( 'syntaxhighlighter/code', { content: unescape( content ) } );
},
},
],
Expand All @@ -44,7 +46,7 @@ export default {
type: 'block',
blocks: [ 'core/code' ],
transform: ( { content } ) => {
return createBlock( 'core/code', { content } );
return createBlock( 'core/code', { content: escapeHTML( content ) } );
},
},
],
Expand Down

0 comments on commit 28945a4

Please sign in to comment.