GithubHelp home page GithubHelp logo

MDX Parser about tree-sitter-markdown HOT 4 OPEN

barrett-ruth avatar barrett-ruth commented on June 17, 2024
MDX Parser

from tree-sitter-markdown.

Comments (4)

MDeiml avatar MDeiml commented on June 17, 2024

This has been discussed earlier, specifically see this issue and comment: #81 (comment)

You don't need to look at parsers for TS or MDX I think, since the javascript in these files would best be parsed using language injection. Basically you don't need to worry about parsing javascript, you just need to able to properly mark places where there is javascript, i.e. export statements, curly braces.

You're right that MDX would probably best be implemented as a superset / fork of this parser rather than from ground up, since most of the syntax is markdown anyways.

The main difficulty in implementing this is then understanding the markdown parser with markdown being a very messy language. It's probably helpful to read through the entirety of this page first if you haven't done so yet.

from tree-sitter-markdown.

barrett-ruth avatar barrett-ruth commented on June 17, 2024

You don't need to look at parsers for TS or MDX I think, since the javascript in these files would best be parsed using language injection. Basically you don't need to worry about parsing javascript, you just need to able to properly mark places where there is javascript, i.e. export statements, curly braces.

Ok great, that's what I thought. I see someone attempted to do it themselves but obviously didn't complete the task.

In that thread, another individual said they'd prefer MDX as a separate parser -- and I happen to agree. MDX seems to be a completely different language and I don't think it should be implemented on top of ts-markdown (unless it becomes stable in a long time). Once I start this in a few months I think forking will be the best option, although I'm not sure how keeping it updated will work.

Also, thanks for your patience constantly dealing with people who don't know a lot when you seem to be an expert on the matter. Hopefully I can contribute something meaningful in a month or two (or three).

from tree-sitter-markdown.

MDeiml avatar MDeiml commented on June 17, 2024

Haha, I'm not an expert by far, but I appreciate the comment. Feel free to ask me any questions that come up.

from tree-sitter-markdown.

avvo-na avatar avvo-na commented on June 17, 2024

Although code highlighting within backtick blocks does indeed work when tagged as JS, its just not enough. There is very little support for good syntax higlighting within an MDX file, a lot of things like top level imports just don't get highlighted currently.

from tree-sitter-markdown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.