@@ -31,4 +31,40 @@ suite('PlainTextRenderer', () => {
3131 const result = marked . parse ( 'rename the `Foo` class to `Bar`' , { renderer, smartypants : true } ) ;
3232 assert . strictEqual ( result . trim ( ) , 'rename the \\`Foo\\` class to \\`Bar\\`' ) ;
3333 } ) ;
34+
35+ test ( 'should strip strong formatting by default' , ( ) => {
36+ const renderer = new PlainTextRenderer ( ) ;
37+ const result = marked . parse ( 'This is **bold** text' , { renderer, smartypants : true } ) ;
38+ assert . strictEqual ( result . trim ( ) , 'This is bold text' ) ;
39+ } ) ;
40+
41+ test ( 'should preserve strong formatting when allowSimpleMarkdown is true' , ( ) => {
42+ const renderer = new PlainTextRenderer ( true ) ;
43+ const result = marked . parse ( 'This is **bold** text' , { renderer, smartypants : true } ) ;
44+ assert . strictEqual ( result . trim ( ) , 'This is **bold** text' ) ;
45+ } ) ;
46+
47+ test ( 'should strip em formatting by default' , ( ) => {
48+ const renderer = new PlainTextRenderer ( ) ;
49+ const result = marked . parse ( 'This is *italic* text' , { renderer, smartypants : true } ) ;
50+ assert . strictEqual ( result . trim ( ) , 'This is italic text' ) ;
51+ } ) ;
52+
53+ test ( 'should preserve em formatting when allowSimpleMarkdown is true' , ( ) => {
54+ const renderer = new PlainTextRenderer ( true ) ;
55+ const result = marked . parse ( 'This is *italic* text' , { renderer, smartypants : true } ) ;
56+ assert . strictEqual ( result . trim ( ) , 'This is *italic* text' ) ;
57+ } ) ;
58+
59+ test ( 'should handle combined formatting when allowSimpleMarkdown is true' , ( ) => {
60+ const renderer = new PlainTextRenderer ( true ) ;
61+ const result = marked . parse ( 'rename the `Foo` class to **`Bar`** and make it *italic*' , { renderer, smartypants : true } ) ;
62+ assert . strictEqual ( result . trim ( ) , 'rename the `Foo` class to **`Bar`** and make it *italic*' ) ;
63+ } ) ;
64+
65+ test ( 'should strip all formatting by default' , ( ) => {
66+ const renderer = new PlainTextRenderer ( false ) ;
67+ const result = marked . parse ( 'rename the `Foo` class to **`Bar`** and make it *italic*' , { renderer, smartypants : true } ) ;
68+ assert . strictEqual ( result . trim ( ) , 'rename the \\`Foo\\` class to \\`Bar\\` and make it italic' ) ;
69+ } ) ;
3470} ) ;
0 commit comments