UNPKG

@atlaskit/editor-wikimarkup-transformer

Version:

Wiki markup transformer for JIRA and Confluence

21 lines (20 loc) 882 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.codeBlock = void 0; var _inlines = require("./inlines"); var 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']; var codeBlock = exports.codeBlock = function codeBlock(node) { var result = ''; node.forEach(function (n) { result += (0, _inlines.inlines)(n, { parent: node }); }); if (supportedLanguageInWiki.indexOf(node.attrs.language) !== -1) { return "{code:".concat(node.attrs.language, "}").concat(result, "{code}"); } else { return "{noformat}".concat(result, "{noformat}"); } };