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

Add support for .edn / EDN syntax (identical to Clojure) #3205

Closed
stelcodes opened this issue May 27, 2021 · 3 comments · Fixed by #3213
Closed

Add support for .edn / EDN syntax (identical to Clojure) #3205

stelcodes opened this issue May 27, 2021 · 3 comments · Fixed by #3213
Labels
enhancement An enhancement or new feature good first issue Should be easier for first time contributors help welcome Could use help from community parser

Comments

@stelcodes
Copy link
Contributor

Hello! I'm a Clojure programmer, and it seems like highlight.js could easily support EDN syntax highlighting by adding "edn" to the Clojure aliases. EDN is to Clojure what JSON is to JS. The syntax highlighting is equivalent. Is this reasonable? I use Gitea and the EDN files do not get any syntax highlighting.

aliases: [ 'clj' ],

@stelcodes stelcodes added enhancement An enhancement or new feature parser labels May 27, 2021
@joshgoebel
Copy link
Member

joshgoebel commented May 27, 2021

Perhaps. Is this an official part of Clojure or some 3rd party library? Please provide a link so I could learn more.

It's easy enough to add your own aliases though:

hljs.registerAliases(["edn"],{ languageName: "clojure" })

EDN is to Clojure what JSON is to JS.

Worth noting, JS and JSON are not the same thing/grammar at all... so if that's truly a fair comparison this might be a no.

@stelcodes
Copy link
Contributor Author

Hi! Yes I can provide more info. I didn't know that about JSON syntax being way different from JS! Maybe not a good comparison at all. I was just trying to say it's a subset of Clojure syntax.

EDN is definitely an official part of Clojure. Here is the official specification from the core clojure team. Clojure has built in support for working with it. Here is the overview from the offical spec:

edn is an extensible data notation. A superset of edn is used by Clojure to represent programs, and it is used by Datomic and other applications as a data transfer format. This spec describes edn in isolation from those and other specific use cases, to help facilitate implementation of readers and writers in other languages, and for other uses.

@joshgoebel
Copy link
Member

At a glance it seems this is indeed a subset of Clojure so I think this is something we could do. A PR would be welcome.

@joshgoebel joshgoebel added good first issue Should be easier for first time contributors help welcome Could use help from community labels May 30, 2021
@stelcodes stelcodes mentioned this issue May 30, 2021
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement An enhancement or new feature good first issue Should be easier for first time contributors help welcome Could use help from community parser
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants