Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should have syntax highlighting plugins available #6

Open
saibotsivad opened this issue Jun 17, 2020 · 0 comments
Open

Should have syntax highlighting plugins available #6

saibotsivad opened this issue Jun 17, 2020 · 0 comments

Comments

@saibotsivad
Copy link
Owner

These are some notes and code samples based on an evening of research.

Since I've never worked with language grammar syntax before, in any meaningful sense, this has been quite an adventure.

I'm using Sublime Text 3, which has its own special syntax, but seems familiar with TextMate, which seems to be a common one.

Here are a slew of links:

One of the bigger problems I ran into was figuring out what scope to put on things.

Following are my notes. As you can see, I did not get very far...

%YAML 1.2
---

file_extensions:
  - md

scope: text.blockdown

variables:
  blockdown_start: '^(---\!)'
  greedy_capture: '.+\]$'
  blockdown_name_end: '(\#|\[|$)'

contexts:
  main:
    - match: |-
          (?x:
            {{blockdown_start}}
            (?i:javascript|js)
            (?:
              {{greedy_capture}}
              | (?:
                (?:[^\[]+\[$)
                (?m:(?:[^\]]+))
                ^\]$
              )
            )
          )
      captures:
        0: meta.code-fence.definition.begin.javascript.blockdown-gfm
        1: punctuation.definition.raw.code-fence.begin.blockdown
        2: constant.other.language-name.blockdown
      embed: scope:source.js
      embed_scope: markup.raw.code-fence.javascript.blockdown-gfm
      escape: '(?:^---\!)'
      escape_captures:
        0: meta.code-fence.definition.end.javascript.blockdown-gfm punctuation.definition.raw.code-fence.end.blockdown

    # - match: |-
    #     (?x:
    #       ^             # at the very start of the line
    #       (---\!)       # the block delimiter starter
    #       ([^\[#]+)     # name: everything up to the first open square bracket or hash
    #       (?:           # id section
    #         (\#)        # the hash is the id delimiter
    #         ([^\[]+)    # everything up to the first open square bracket is the id
    #       )?            # id section is optional
    #       (?:           # single-line metadata
    #         (\[)        # the open square bracket is the start
    #         ([^\]]+)    # everything up to the final close square bracket is the metadata
    #         (\])$       # the last close square bracket is the end of the metadata section
    #       )?            # single-line metadata section is optional
    #     )
    #   captures:
    #     1: markup.raw.block.blockdown
    #     2: variable.fenced.blockdown
    #     3: punctuation.definition.constant.end.blockdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant