# Writing reporters

A reporter is a function that takes three parameters:
- `report`: the pnark report
- `req`: the current http request
- `res`: the response for the current http request

`report` is the report that will be generated by your reporter.
You can call `report.section(title)` to add a new section:

```js
var mySection = report.section('My Section');
```

Once you have a section you can start adding information to it:

```js
mySection.html('<p>Hello <strong>World</strong></p>');
```

```js
mySection.text('Hello World');
```

```js
mySection.markdown('Hello **World**'); //github flavored
```

```js
mySection.json({ a:1, b:'2' }); //will be highlighted in the browser
```

Charts, powered by [HighCharts](http://www.highcharts.com/) ([docs](http://api.highcharts.com/highcharts)/[examples](http://www.highcharts.com/demo)):

```js
mySection.highchart({
    title: {
        text: 'Monthly Average Temperature'
    },
    xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },
    yAxis: {
        title: 'Temperature (°C)'
    },
    tooltip: {
        valueSuffix: '°C'
    },
    series: [{
        data: [7.0, 6.9, 9.5, 14.5, 18.2, 21.5, 25.2, 26.5, 23.3, 18.3, 13.9, 9.6]
    }]
});
```

> *NOTE: Please be sure that your usage falls under HighCharts' [Non-Commercial License](http://creativecommons.org/licenses/by-nc/3.0/) or you have purchased a [Commercial License](http://shop.highcharts.com/highcharts/).*

You can also create subsections:

```js
var additionalInformation = mySection.section('Additional Information')
```

Which also have the same available methods:

```js
additionalInformation.html('<p>More info</p>')
additionalInformation.section('Another Level!')
```

Call `report.end()` when you are done.
