Giter VIP home page Giter VIP logo

Comments (2)

tolmasky avatar tolmasky commented on May 12, 2024

As I'm going through more of these, I'm trying to find a way to balance some SyntaxDefinition additions without making them be super-specific to the markdown mode. Basically, I want:

  1. A way to map all other SyntaxDefinitions
  2. Grab their filename recognitions to generate the fences.

I hate turning XML into an imperative thing, but "conceptually", I want something like this:

    <modes>
            <state id="CodeBlock-{mode.name}" usesymbolsfrommode="{mode.name}" useautocompletefrommode="{mode.name}" foldable="yes" scope="meta.block.{mode.name.toLowerCase()}">
                <begin><regex>^```(?:([^\.]*.)?({mode.fileextensions.join("|")}|{mode.filinames.join("|")|{mode.name}|{mode.aliases.join("|")})</regex></begin>
                <end><regex>```</regex></end>
                <import mode = "{mode.name}" />
            </state>
   </modes>

Something like that. I'm basing the codefence recognition on GitHub's, which is in turn based on the rouge library. If we look at just ruby as an example, we see why we need to support a whole bunch of different "types" of things ( https://github.com/jneen/rouge/blob/master/lib/rouge/lexers/ruby.rb#L11 ):

file extensions:

'.rb',
'
.ruby',
'.rbw',
'
.rake',
'.gemspec',
'
.podspec',
'.ru',
'
.prawn',
'*.arb'

filenames:

'Rakefile',
'Guardfile',
'Gemfile',
'Capfile',
'Podfile',
'Vagrantfile',
'Berksfile',
'Dangerfile'

language names and aliases:

'ruby'
'rb' (handled by *.rb above already).

Anyways, just want to post current status. As I mentioned above, might be a good intermediate step to just have a build step inline all these modes and create the markdown mode. But eventually we want it to pick up on user's custom modes, and ideally do so live without restarting.

from subethaedit.

monkeydom avatar monkeydom commented on May 12, 2024

I'm closing this one with the merge of pull request #65 so it doesn't get lost in the Changelog. Please do file a fresh issue for further improvements.

Fixed in d9d2e93

from subethaedit.

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.