Skip to content

Commit

Permalink
Merge pull request gnab#347 from pospi/inline-code-hilighting
Browse files Browse the repository at this point in the history
add new option to highlight inline code spans using default language
  • Loading branch information
gnab authored Jul 27, 2016
2 parents 26f82fb + 3866ad0 commit 65218fa
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/remark/models/slideshow.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function Slideshow (events, dom, options, callback) {
self.getHighlightStyle = getOrDefault('highlightStyle', 'default');
self.getHighlightLines = getOrDefault('highlightLines', false);
self.getHighlightSpans = getOrDefault('highlightSpans', false);
self.getHighlightInlineCode = getOrDefault('highlightInlineCode', false);
self.getHighlightLanguage = getOrDefault('highlightLanguage', '');
self.getSlideNumberFormat = getOrDefault('slideNumberFormat', '%current% / %total%');

Expand Down
12 changes: 8 additions & 4 deletions src/remark/views/slideView.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,18 +212,22 @@ function highlightCodeBlocks (content, slideshow) {
var codeBlocks = content.getElementsByTagName('code'),
highlightLines = slideshow.getHighlightLines(),
highlightSpans = slideshow.getHighlightSpans(),
highlightInline = slideshow.getHighlightInlineCode(),
meta;

codeBlocks.forEach(function (block) {
if (block.className === '') {
block.className = slideshow.getHighlightLanguage();
}

if (block.parentElement.tagName !== 'PRE') {
utils.addClass(block, 'remark-inline-code');
if (highlightInline) {
highlighter.engine.highlightBlock(block, '');
}
return;
}

if (block.className === '') {
block.className = slideshow.getHighlightLanguage();
}

if (highlightLines) {
meta = extractMetadata(block);
}
Expand Down

0 comments on commit 65218fa

Please sign in to comment.