build(aio): do not HTML format code-example contents (#15554)

The markdown renderer passes its output through an HTML pretty printer.
While this is good in most cases, it makes a mess of elements that expect
their content to be left untouched.

The pretty printer already ignores `pre` tags (and other built-ins) by
default. This fix allows us to specify other tags that should be left
alone.

Further it actually specifies this option for `code-example` and `code-pane`
tags, which expect to contain preformatted content.
This commit is contained in:
Pete Bacon Darwin
2017-03-28 16:22:44 +01:00
committed by Igor Minar
parent b7a89cec59
commit eac99c1b16
6 changed files with 48 additions and 21 deletions

View File

@ -201,7 +201,7 @@ module.exports =
// Configure nunjucks rendering of docs via templates
.config(function(
renderDocsProcessor, versionInfo, templateFinder, templateEngine, getInjectables) {
renderDocsProcessor, versionInfo, templateFinder, templateEngine, getInjectables, renderMarkdown) {
// Where to find the templates for the doc rendering
templateFinder.templateFolders = [TEMPLATES_PATH];
@ -228,6 +228,12 @@ module.exports =
renderDocsProcessor.helpers.relativePath = function(from, to) {
return path.relative(from, to);
};
// Tell the HTML formatter not to format code-example blocks
renderMarkdown.unformattedTags = [
'code-example',
'code-pane'
];
})