From 648de7dd86ca2d29ede4bffd4f8565cf082c143f Mon Sep 17 00:00:00 2001 From: Peter Bacon Darwin Date: Wed, 19 Apr 2017 09:27:45 +0100 Subject: [PATCH] build(aio): render titles correctly in content pages If a document provided a title jsdoc tag then its h1 element was being rendered incorrectly as a markdown paragraph. This change renders the title as a markdown h1 tag directly. Fixes #16099 --- aio/e2e/app.e2e-spec.ts | 7 +++++++ aio/tools/transforms/templates/content.template.html | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/aio/e2e/app.e2e-spec.ts b/aio/e2e/app.e2e-spec.ts index 1955dc777f..1a941da2f4 100644 --- a/aio/e2e/app.e2e-spec.ts +++ b/aio/e2e/app.e2e-spec.ts @@ -49,6 +49,13 @@ describe('site App', function() { }); }); + describe('tutorial docs', () => { + it('should not render a paragraph element inside the h1 element', () => { + page.navigateTo('tutorial/toh-pt1'); + expect(element(by.css('h1 p')).isPresent()).toBeFalsy(); + }); + }); + describe('google analytics', () => { beforeEach(done => page.gaReady.then(done)); diff --git a/aio/tools/transforms/templates/content.template.html b/aio/tools/transforms/templates/content.template.html index 82c8c864ce..a9216df1df 100644 --- a/aio/tools/transforms/templates/content.template.html +++ b/aio/tools/transforms/templates/content.template.html @@ -1,4 +1,4 @@ -{% if doc.title %}

{$ doc.title | marked $}

{% endif %} +{% if doc.title %}{$ ('# ' + doc.title.trim()) | marked $}{% endif %}
{$ doc.description | marked $}
\ No newline at end of file