diff --git a/aio/transforms/rho-package/index.js b/aio/transforms/rho-package/index.js deleted file mode 100644 index 9726720bf6..0000000000 --- a/aio/transforms/rho-package/index.js +++ /dev/null @@ -1,9 +0,0 @@ -var Package = require('dgeni').Package; - -/** - * @dgPackage rho - * @description Overrides the renderMarkdown service with an implementation based on Rho - */ -module.exports = new Package('rho', ['nunjucks']) - - .factory(require('./services/renderMarkdown')); diff --git a/aio/transforms/rho-package/services/renderMarkdown.js b/aio/transforms/rho-package/services/renderMarkdown.js deleted file mode 100644 index f5408cf51c..0000000000 --- a/aio/transforms/rho-package/services/renderMarkdown.js +++ /dev/null @@ -1,68 +0,0 @@ -const rho = require('rho'); -const { prettyPrint } = require('html'); - -const defaultUnformattedTags = [ - 'a', 'span', 'bdo', 'em', 'strong', 'dfn', 'code', 'samp', 'kbd', 'var', 'cite', 'abbr', 'acronym', - 'q', 'sub', 'sup', 'tt', 'i', 'b', 'big', 'small', 'u', 's', 'strike', 'font', 'ins', 'del', 'pre', - 'address', 'dt', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6']; - -/** - * @dgService renderMarkdown - * @description - * Render the markdown in the given string as HTML. - */ -module.exports = function renderMarkdown() { - - - // TODO(petebd): We might want to remove the leading whitespace from the code - // block before it gets to the markdown code render function - - // We need to teach Rho about inline tags so that it doesn't try to process - // the inside of the tag - const emitNormal = rho.InlineCompiler.prototype.emitNormal; - rho.InlineCompiler.prototype.emitNormal = function(walk) { - if (this.emitText(walk)) return; - if (tryDgeniInlineTag(this, walk)) return; - emitNormal.call(this, walk); - }; - - rho.BlockCompiler.prototype.emitBlock = function(walk) { - walk.skipBlankLines(); - this.countBlockIndent(walk); - if (this.tryUnorderedList(walk)) return; - if (this.tryOrderedList(walk)) return; - if (this.tryDefinitionList(walk)) return; - if (this.tryHeading(walk)) return; - if (this.tryCodeBlock(walk)) return; - if (this.tryDiv(walk)) return; - if (this.tryHtml(walk)) return; - if (tryDgeniInlineTag(this, walk, true)) return; - if (this.tryHrTable(walk)) return; - this.emitParagraph(walk); - }; - - function tryDgeniInlineTag(compiler, walk, isBlock) { - if (!walk.at('{@')) return false; - - const startIdx = walk.position; - var endIdx = walk.indexOf('}'); - - if (endIdx === null) return false; - - if (isBlock) compiler.out.push('
A paragraph with bold and italic.
\n' + - 'A paragraph.
\n' + - 'Another paragraph
'); - }); - - it('should not format the contents of tags marked as unformatted ', () => { - renderMarkdown.unformattedTags = ['code-example']; - const content = '' + - 'A aa aaa aaaa aaaaa aaaaaa aaaaaaa aaaaaaaa aaaaaaaaa aaaaaaaaaa aaaaaaaaaaa\n' + - 'foo bbb.' + - '
'; - - expect(renderMarkdown(input)).toEqual(output); - }); -});