atom / language-gfm

GitHub Flavored Markdown in Atom
MIT License
101 stars 108 forks source link

Include html and liquid grammars #154

Open burodepeper opened 8 years ago

burodepeper commented 8 years ago

See #145 for a discussion on this issue. The discussion focuses on liquid, but I noticed that html was missing so I included that too.

I've used the same approach as I have for language-markdown. I haven't found a convenient way to write specs for included grammars, but I think it's acceptable to defer this to the corresponding packages themselves.

fusion809 commented 8 years ago

@burodepeper Ah, it ain't working. I just cloned this repo, applied your patch (which I downloaded from https://github.com/atom/language-gfm/pull/154.patch) and rank apm link language-gfm from its parent directory and reloaded Atom with Ctrl+Alt+R. Then I restarted Atom just to make sure and still I'm seeing this... screenshot from 2016-05-20 21-29-57

Guessing this is to be fixed by the language-liquid fixes being made?

burodepeper commented 8 years ago

Could you paste that sample code directly so I can test it locally? I took some samples from liquidmarkup.org and had no issues.

fusion809 commented 8 years ago

Just answered my own question and tried out the latest language-liquid adjustments you's have made and got this:

screenshot from 2016-05-20 21-34-41

So it's all working!

burodepeper commented 8 years ago

Haha, so it works ; )

winstliu commented 8 years ago

This is currently blocked on https://github.com/atom/language-todo/pull/43#issuecomment-219295277. We're not sure yet whether we want to accept PRs that add support for languages not under the Atom organization.

fusion809 commented 8 years ago

Well Liquid is the templating engine used by GitHub's official SSG, Jekyll, so I must admit I'm surprised that the Atom organization has not created their own Liquid package.

burodepeper commented 8 years ago

@50Wliu Understandable, yet still a bummer. (slightly off-topic) I'm not sure what the best place would be to add the following comment (which indirectly relates to the issue you linked to), but I'm always rather reluctant to submit PRs for core packages because they don't get as much "love" as you'd want them to get. I do of course understand the added workload for the Atom devs, and I mean nothing but respect. I would like to see a subset of the core packages (in particular the stand-alonish ones, such as the languages and themes) to be updated outside of the regular update cycle.

(more on-topic) Another way to possibly work around this would be to have the liquid grammar inject itself into other grammars, in the same way that language-todo works. I don't know if this is possible however, because files ending in .css.liquid won't be picked up language-css for the same blocking issue mentioned above. @puranjayjain: any ideas on this?

fusion809 commented 8 years ago

@burodepeper I have an idea. How about we (not even sure if I should say "we" as I'm light on programming skills besides in shell script) create a new package called language-gfm-liquid (or w/e, the name isn't important to me) that provides syntax highlighting for Markdown, Liquid and HTML, essentially a love-child of the language-liquid and language-gfm packages, with this pull injected in. It wouldn't necessary pass its embedded (in Markdown files) Liquid and HTML code onto another package, but would rather render it itself. So it would have the grammars of language-liquid inserted into it. If this is what you meant in your last comment, sorry, wasn't sure if it was.

winstliu commented 8 years ago

Another way to possibly work around this would be to have the liquid grammar inject itself into other grammars, in the same way that language-todo works.

I would love for this to happen.

puranjayjain commented 8 years ago

Another way to possibly work around this would be to have the liquid grammar inject itself into other grammars, in the same way that language-todo works.

@burodepeper @50Wliu I would want something like that to happen (documented too) since many of the languages depend on each other like the most common html with inline css, js.

Another scenario that comes in my mind is that of a template-based languages which add on top of another language, in those cases they must inherit the parent language (or languages) and add on top of it.

I would want both of this to be documented to ease the development of language packages as such

Now on topic I think the both the approach would do wonders to our .css.liquid files. There must be a way to do something like this (abstract code). Similar to @burodepeper 's approach in language-markdown

some-pattern: {
inherit: language-css
}

So that part of the code can enjoy language-css and autocomplete along with their tokenisation yet being a part of language liquid

fusion809 commented 8 years ago

Well if anyone wants a quick solution, before these pull issues are resolved see my new fork of this package language-gfm2. I have even incorporated this package and language-liquid in the Atom package my atom-installer (a cross-distribution Atom installer for Linux written in Shell script) builds and installs.

mime0n commented 7 years ago

Hello. I'm a beginner and really don't understand how to install language-liquid into Atom. In Atom I have language-gfm already installed but I see no package called language-liquid. How would I go about getting language-liquid working in Atom?

I tried following the instruction at the top from fusion809 https://github.com/atom/language-gfm/pull/154#issuecomment-220582863 but I have no idea how to apply patches. Totally lost.