Skip to content
This repository has been archived by the owner on Nov 28, 2022. It is now read-only.

feat: add support for syntax highlighting more languages #728

Merged
merged 17 commits into from
Jun 3, 2020

Conversation

erunion
Copy link
Member

@erunion erunion commented Jun 3, 2020

🧰 What's being changed?

Adds support to syntax highlight the following languages:

  • CoffeeScript
  • Clojure
  • D
  • Erlang
  • Groovy
  • Handlebars
  • HTTP
  • Julia
  • LESS
  • Perl
  • Rust
  • SASS
  • YAML

Languages from https://github.com/readmeio/api-explorer/issues/726 that I'm opting to not implement right now because their popularity is limited:

  • Cypher
  • Haxe
  • Jinja
  • Lua
  • Smarty
  • TOML
  • Twig

I've also slightly refactored the Code component in @readme/markdown to no longer maintain a separate syntax highlighting language mapping object, and instead to pull that data from the syntax highlighter itself via a new canonical library within it. This library takes in a language name and returns a canonical version of it. For example, supplying js will return javascript, cpp will return cplusplus, sass to css, etc. This should make adding support for new languages less tedious.

Resolves https://github.com/readmeio/api-explorer/issues/726.

🗳 Checklist

💡 If answering yes to any of the following, include additional info, before/after links, screenshots, etc. where appropriate!

  • 🆕 I'm adding something new!
  • 🐛 I'm fixing a bug!
  • 📸 I've made some changes to the UI!

@erunion erunion marked this pull request as ready for review June 3, 2020 03:16
@erunion erunion added the type:enhancement A potential new feature to be added, or an improvement we could make label Jun 3, 2020
@erunion erunion requested a review from rafegoldberg June 3, 2020 03:16
@erunion erunion requested a review from julshotal June 3, 2020 04:32
@erunion
Copy link
Member Author

erunion commented Jun 3, 2020

Once this is out we can replace the Language Support docs on the RDMD site directly with the language support docs in @readme/syntax-highlighter. ✨

aliases: {
powershell: 'PowerShell',
ps1: 'PowerShell',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -0,0 +1,60 @@
const modeAliases = {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be kind of tedious to maintain this list along with uppercase.js instead of just a single supportedLanguages file, but also I think the object management, and cycles, that'll need to be done to make a single datastore work for both of these usecases (canonical and uppercase) outweighs just loading another 60 line JS file.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah the manual maintenance is a bit of a pain, but I agree: worth it compared to the alternative!

@erunion erunion requested a review from gratcliff June 3, 2020 04:41
Copy link
Contributor

@rafegoldberg rafegoldberg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for grabbing this Jon.

@erunion erunion merged commit 13cb4e4 into master Jun 3, 2020
@erunion erunion deleted the feat/support-more-syntax-highlights branch June 3, 2020 15:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type:enhancement A potential new feature to be added, or an improvement we could make
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add support for missing languages
2 participants