github.com/servernoj/jade@v0.0.0-20231225191405-efec98d19db1/testdata/v2/filters.jade (about)

     1    p
     2      :markdown-it(inline) **BOLD TEXT**
     3  
     4    p.
     5      In the midst of a large amount of plain
     6      text, suddenly a wild #[:markdown-it(inline) *Markdown*]
     7      appeared.
     8  
     9  
    10    script
    11      :cdata-js:babel(presets=['es2015'])
    12        const myFunc = () => `This is ES2015 in a CD${'ATA'}`;
    13  
    14  :go:import
    15    "github.com/Joker/jade"
    16    "github.com/Joker/hpp"
    17  //- 
    18    \\\\\\\\\\ options.js <
    19    options.filters = {
    20      'my-own-filter': function (text, options) {
    21        if (options.addStart) text = 'Start\n' + text;
    22        if (options.addEnd)   text = text + '\nEnd';
    23        return text;
    24      }
    25    };
    26    \\\\\\\\\\ index.pug <
    27  p
    28    :my-own-filter(addStart addEnd)
    29      Filter
    30      Body
    31    //- 
    32      \\\\\\\\\\ output.html >
    33      <p>
    34        Start
    35        Filter
    36        Body
    37        End
    38      </p>
    39  
    40    div
    41      #function
    42        :go:func Output(user string, buffer *bytes.Buffer)