GitHub-Markdown.tmbundle icon indicating copy to clipboard operation
GitHub-Markdown.tmbundle copied to clipboard

Add xml code block support

Open ogallagher opened this issue 4 years ago • 0 comments

Could you add ```xml code block support? I’m not sure how to modify the source to generate the proper modified language grammar for a pull request. However, using the Edit Bundles menu, I was able to add the following to get the desired effect by using the other highlighting entries as examples and direction from this gist:

// Addition of xml code block to github markdown bundle via direct modification
// of generated language grammar.
{
    patterns= (
        // other existing entries...
        {
            name = 'markup.raw.block.xml';
            begin = '(^|\G)\s*([`~]{3,})\s*(xml)\s*$';
            end = '(^|\G)\s*(\2)\n?';
            beginCaptures = {
        		2 = { name = 'punctuation.definition.raw.begin.markdown'; };
        		3 = { name = 'storage.type.language.markdown'; };
            };
            endCaptures = { 2 = { name = 'punctuation.definition.raw.end.markdown'; }; };
            contentName = 'text.xml';
            patterns = ( { include = 'text.xml'; } );
        }
    );
}

ogallagher avatar Nov 09 '20 02:11 ogallagher