-
Notifications
You must be signed in to change notification settings - Fork 23
feat: add support for syntax highlighting more languages #728
Conversation
Can be used to retrieve a "canonical" name for a given language.
Once this is out we can replace the Language Support docs on the RDMD site directly with the language support docs in |
aliases: { | ||
powershell: 'PowerShell', | ||
ps1: 'PowerShell', |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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!
There was a problem hiding this 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.
🧰 What's being changed?
Adds support to syntax highlight the following languages:
Languages from https://github.com/readmeio/api-explorer/issues/726 that I'm opting to not implement right now because their popularity is limited:
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 newcanonical
library within it. This library takes in a language name and returns a canonical version of it. For example, supplyingjs
will returnjavascript
,cpp
will returncplusplus
,sass
tocss
, etc. This should make adding support for new languages less tedious.Resolves https://github.com/readmeio/api-explorer/issues/726.
🗳 Checklist