# All files / blocks/markdown index.js

0% Statements 0/1
100% Branches 0/0
100% Functions 0/0
0% Lines 0/1

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46

     /**
     * WordPress Markdown Block
     *
     * @package WpGfmRenderer
     */

    import { registerBlockType } from '@wordpress/blocks';
    import { __ } from '@wordpress/i18n';

    import Edit from './edit';
    import save from './save';
    import deprecated from './deprecated';
    import metadata from './block.json';

    /**
     * Register Markdown block
     */
    registerBlockType( metadata.name, {
    	title: __( 'Markdown', 'markdown-renderer-for-github' ),
    	description: __( 'Write in GitHub Flavored Markdown with real-time preview.', 'markdown-renderer-for-github' ),
    	category: 'text',
    	icon: {
    		src: 'editor-code',
    		foreground: '#007cba'
    	},
    	keywords: [
    		__( 'markdown', 'markdown-renderer-for-github' ),
    		__( 'gfm', 'markdown-renderer-for-github' ),
    		__( 'github', 'markdown-renderer-for-github' ),
    		__( 'code', 'markdown-renderer-for-github' )
    	],
    	// attributes are defined in block.json (includes mermaidBgColor)
    	example: {
    		attributes: {
    			content: '# Heading 1\n\n**Bold** text and *italic* text.\n\n- List item 1\n- List item 2\n\n```javascript\nconst greeting = "Hello, World!";\nconsole.log(greeting);\n```'
    		}
    	},
    	supports: {
    		html: false,
    		className: true,
    		customClassName: true
    	},
    	edit: Edit,
    	save,
    	deprecated
    } );