I use pug as a templating engine.
I'm able to load content on my page. Following some snippets of my code:
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);
}
intro_page.pug
div
each paragraph in explanation
div= paragraph
wished result
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
Is there a way with the pug and my approach to set arbitrarily selected words bold? My online search stilled without result. How can I do this?
I have found my working solution. To whom it my concern:
server.js
Important are the `. Not to be confused with '. Template literals only work with back ticks.
intro_page.pug