UNPKG

@atlaskit/editor-wikimarkup-transformer

Version:

Wiki markup transformer for JIRA and Confluence

15 lines 696 B
import { inlines } from './inlines'; const supportedLanguageInWiki = ['actionscript', 'ada', 'applescript', 'bash', 'c', 'c#', 'c++', 'cpp', 'css', 'erlang', 'go', 'groovy', 'haskell', 'html', 'java', 'javascript', 'js', 'json', 'lua', 'none', 'nyan', 'objc', 'perl', 'php', 'python', 'r', 'rainbow', 'ruby', 'scala', 'sh', 'sql', 'swift', 'visualbasic', 'xml', 'yaml']; export const codeBlock = node => { let result = ''; node.forEach(n => { result += inlines(n, { parent: node }); }); if (supportedLanguageInWiki.indexOf(node.attrs.language) !== -1) { return `{code:${node.attrs.language}}${result}{code}`; } else { return `{noformat}${result}{noformat}`; } };