Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Rob McGuinness committed Jan 31, 2017
2 parents 56b4238 + 91469be commit 8763941
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,19 @@ Override default styles. All css files must reside in the same folder.
#### Xonokai <small>`syntax-highlighting/assets/css/prism/prism-xonokai.css`</small>
![Google Light](http://i.imgur.com/fPjEEv8.png)

### Syntax aliasing

To support non-standard syntax prefixes, you can alias existing prefixes:
```json
"pluginsConfig": {
"prism": {
"lang": {
"flow": "typescript"
}
}
}
```

## Credits

Originally based on https://github.com/spricity/google_code_prettify.
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ var MAP_LANGUAGES = {
'js': 'javascript',
'rb': 'ruby',
'cs': 'csharp',
'sh': 'bash',
'html': 'markup'
};

Expand Down Expand Up @@ -69,10 +70,11 @@ module.exports = {
code: function(block) {

var highlighted = '';
var userDefined = this.config.get('pluginsConfig.prism.lang', {});

// Normalize language id
var lang = block.kwargs.language || DEFAULT_LANGUAGE;
lang = MAP_LANGUAGES[lang] || lang;
lang = userDefined[lang] || MAP_LANGUAGES[lang] || lang;

// Try and find the language definition in components folder
if (!languages[lang]) {
Expand Down

0 comments on commit 8763941

Please sign in to comment.