{"size": 532, "ext": "js", "max_stars_repo_path": "core/server/lib/mobiledoc/cards/code.js", "max_stars_repo_name": "bazgyrt/Ghost-Azure-1", "max_stars_repo_stars_event_min_datetime": "2018-08-11T12:50:36.000Z", "max_stars_repo_stars_event_max_datetime": "2018-08-13T10:45:55.000Z", "max_issues_repo_path": "core/server/lib/mobiledoc/cards/code.js", "max_issues_repo_name": "bazgyrt/Ghost-Azure-1", "max_issues_repo_issues_event_min_datetime": "2020-02-25T06:51:58.000Z", "max_issues_repo_issues_event_max_datetime": "2020-09-09T06:42:39.000Z", "max_forks_repo_path": "core/server/lib/mobiledoc/cards/code.js", "max_forks_repo_name": "bazgyrt/Ghost-Azure-1", "max_forks_repo_forks_event_min_datetime": "2018-08-27T19:14:13.000Z", "max_forks_repo_forks_event_max_datetime": "2018-08-27T21:32:55.000Z"}
{"max_stars_count": 2, "max_issues_count": 28, "max_forks_count": 6, "avg_line_length": 21.28, "max_line_length": 71, "alphanum_fraction": 0.5206766917}
module.exports = {
    name: 'code',
    type: 'dom',
    render(opts) {
        let payload = opts.payload;
        let dom = opts.env.dom;

        if (!payload.code) {
            return '';
        }

        let pre = dom.createElement('pre');
        let code = dom.createElement('code');

        if (payload.language) {
            code.setAttribute('class', `language-${payload.language}`);
        }

        code.appendChild(dom.createTextNode(payload.code));
        pre.appendChild(code);

        return pre;
    }
};
