Skip to content

[language-gfm] Table cells should get inline injections #1636

Description

@savetheclocktower

This is mainly a note to myself so I don't forget to apply a pretty simple fix:

tree-sitter-markdown is actually two parsers in one — one handles block-level elements and the other is injected into inline nodes to handle inline elements. But the block-level parser arguably has a bug: it doesn't always add inline nodes where it should.

For instance, a table creates lots of pipe_table_cell nodes, and each of them should probably have an inline node child to mark where the inline parser should take over. But those don't exist. Thus any valid inline Markdown inside a table cell (emphasis, inline code, hyperlinks) is not properly syntax-highlighted.

Anyway, this is pretty easily worked around:

atom.grammars.addInjectionPoint('source.gfm', {
  type: 'pipe_table_cell',
  language: () => {
    return 'markdown-inline-internal';
  },
  content: (node) => node,
  includeChildren: true,
  languageScope: null
});

A user could even add this to their init.js as a workaround! But I should just add it to the existing injection points created by language-gfm.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions