       text = text.replace ///(\ a|A)n(\ `#{to}`)///g, "$1$2"
     if not startsWithVowel(from) and startsWithVowel(to)
       text = text.replace ///(\ a|A)(\ `#{to}`)///g, "$1n$2"
-  if currentLanguage == 'cpp'
+  if currentLanguage == 'cpp' and excludeCpp == 'javascript'
     jsRegex = new RegExp "```javascript\n([^`]+)```", 'gm'
     text = text.replace jsRegex, (a, l) =>
       """```cpp

    # TODO: figure out how we are going to handle array methods in Java

    # Don't substitute these within comments
    noComment = '^ *([^/\\r\\n]*?)'
    if language is 'cpp'
      newRegex = new RegExp(noComment + '([^*])new ', 'gm')
      while newRegex.test(s)

module.exports.filterMarkdownCodeLanguages = (text, language) ->
  return '' unless text
  currentLanguage = language or me.get('aceConfig')?.language or 'python'
  excludeCpp = 'cpp'
  unless /```cpp\n[^`]+```\n?/.test text
    excludeCpp = 'javascript'
  excludedLanguages = _.without ['javascript', 'python', 'coffeescript', 'lua', 'java', 'cpp', 'html'], if currentLanguage == 'cpp' then excludeCpp else currentLanguage
  # Exclude language-specific code blocks like ```python (... code ...)``
  # ` for each non-target language.
  codeBlockExclusionRegex = new RegExp "```(#{excludedLanguages.join('|')})\n[^`]+```\n?", 'gm'
