Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/465.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如何用帕格将句子中的一些词加粗/加粗?_Javascript_Node.js_Pug_Jade4j - Fatal编程技术网

Javascript 如何用帕格将句子中的一些词加粗/加粗?

Javascript 如何用帕格将句子中的一些词加粗/加粗?,javascript,node.js,pug,jade4j,Javascript,Node.js,Pug,Jade4j,我使用帕格作为模板引擎 我可以在我的页面上加载内容。下面是我的一些代码片段: server.js 帕格介绍 希望的结果 第一段的第三个字应为粗体 第2段的一字和五字应为粗体 第3段中的一至四个字应为粗体 等等 帕格和我的方法有没有办法将任意选择的单词设置为粗体?我的在线搜索仍然没有结果。我怎样才能做到这一点?我已经找到了我的工作解决方案。我关心的是: server.js routing.get('/introduction', (req, resp) => { loadConte

我使用帕格作为模板引擎

我可以在我的页面上加载内容。下面是我的一些代码片段:

server.js 帕格介绍 希望的结果 第一段的第三个字应为粗体

第2段的一字和五字应为粗体

第3段中的一至四个字应为粗体

等等


帕格和我的方法有没有办法将任意选择的单词设置为粗体?我的在线搜索仍然没有结果。我怎样才能做到这一点?

我已经找到了我的工作解决方案。我关心的是:

server.js
routing.get('/introduction', (req, resp) => {

    loadContent( function(err, content){

        if(content){
            resp.render('intro_page', content);
        }
    });
});


function loadContent( cb ){
    const cont = {
        explanation: ['Word three of paragraph one shall be bold. ', 'Words one and five of paragraph 2 shall be bold.', 'Words one up to four of paragraph 3 shall be bold.', 'and so on'],
    };

    return cb(null, cont);
}
div
    each paragraph in explanation
        div= paragraph
routing.get('/introduction', (req, resp) => {

    loadContent( function(err, content){

        if(content){
            resp.render('intro_page', content);
        }
    });
});


function loadContent( cb ){
    const bo = '<span style="font-weight: bold">';
    const bc = '</span>';
    const bk = '<br/><br/>';
    const cont = {
        explanation: [`Word three ${bo} of ${bc} paragraph one shall be bold. ${bo} Words ${bc} one and five ${bo} of ${bc} paragraph 2 shall be bold. ${bo} Words one up to ${bc} four of paragraph 3 shall be bold. ${bk} and so on`],
    };

    return cb(null, cont);
}
div
    div= !{explanation}