@@ -26,6 +26,21 @@ func TestHTML2Text(t *testing.T) {
2626 So (HTML2Text (`<p>two</p><p>paragraphs</p>` ), ShouldEqual , "two\r \n paragraphs" )
2727 })
2828
29+ Convey ("Headings" , func () {
30+ So (HTML2Text ("<h1>First</h1>main text" ), ShouldEqual , "First\r \n \r \n main text" )
31+ So (HTML2Text ("First<h2>Second</h2>next section" ), ShouldEqual , "First\r \n \r \n Second\r \n \r \n next section" )
32+ So (HTML2Text ("<h2>Second</h2>next section" ), ShouldEqual , "Second\r \n \r \n next section" )
33+ So (HTML2Text ("Second<h3>Third</h3>next section" ), ShouldEqual , "Second\r \n \r \n Third\r \n \r \n next section" )
34+ So (HTML2Text ("<h3>Third</h3>next section" ), ShouldEqual , "Third\r \n \r \n next section" )
35+ So (HTML2Text ("Third<h4>Fourth</h4>next section" ), ShouldEqual , "Third\r \n \r \n Fourth\r \n \r \n next section" )
36+ So (HTML2Text ("<h4>Fourth</h4>next section" ), ShouldEqual , "Fourth\r \n \r \n next section" )
37+ So (HTML2Text ("Fourth<h5>Fifth</h5>next section" ), ShouldEqual , "Fourth\r \n \r \n Fifth\r \n \r \n next section" )
38+ So (HTML2Text ("<h5>Fifth</h5>next section" ), ShouldEqual , "Fifth\r \n \r \n next section" )
39+ So (HTML2Text ("Fifth<h6>Sixth</h6>next section" ), ShouldEqual , "Fifth\r \n \r \n Sixth\r \n \r \n next section" )
40+ So (HTML2Text ("<h6>Sixth</h6>next section" ), ShouldEqual , "Sixth\r \n \r \n next section" )
41+ So (HTML2Text ("<h7>Not Header</h7>next section" ), ShouldEqual , "Not Headernext section" )
42+ })
43+
2944 Convey ("HTML entities" , func () {
3045 So (HTML2Text (`two spaces` ), ShouldEqual , "two spaces" )
3146 So (HTML2Text (`© 2017 K3A` ), ShouldEqual , "© 2017 K3A" )
0 commit comments