Skip to content

How to achieve both 'block' and 'inline' Markdown highlighting? #10

Description

@dvclmn

Hi Marcin, thanks for all the incredible TextKit-related work you've done — and shared. Your projects have been an invaluable resource.

Issue

When assigning language: .markdown as the NeonPlugin language, only block grammar such as fenced code blocks, quotes, lists, headings etc are styled.

As I understand it, TreeSitter can/does use a two-pass parse (ha) for markdown, for block and inline grammar? Is this correct? If so, will I need to implement my own code to achieve this second parsing operation — or indeed, is this even possible? Based on my very tentative TextKit intuition, this sounds expensive. But perhaps (hopefully!) I'm just missing a trick.

Reproduction

I have created an STTextView as per the basic defaults, as outlined in the readme's for this and the main project.

STTextViewUI.TextView(
    text: $text,
    selection: $selection,
    options: [.wrapLines, .highlightSelectedLine],
    plugins: [NeonPlugin(theme: .default, language: .markdown)]
)

My hope was to see such strings as "inline code", "italic text" etc styled in the typical fashion, but only the block elements mentioned above are receiving styling.

Thanks in advance for any help you can provide.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions