Skip to content

Commit

Permalink
feat: support for relatedIssues frontmatter field
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed Mar 30, 2023
1 parent 92adec7 commit 716eaae
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/html/header-material.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ export default async function run (doc, opt, ctx) {
});
}
else ctx.error(`Frontmatter must have an editors field.`);
if (opt.relatedIssues) {
metaEls.push(el('dt', {}, [`Related Issue${opt.relatedIssues.length > 1 ? 's' : ''}`]));
opt.relatedIssues.forEach(urlStr => {
let url = new URL(urlStr);
let name = url.hostname + url.pathname
if (url.hostname == 'github.com') {
name = url.pathname
}
if (name.startsWith('/')) {
name = name.substring(1)
}
metaEls.push(el('dd', {}, [el('a', { href: url.toString() }, [name])]));
})
}
const dl = metaEls.length ? el('dl', null, metaEls) : null;
const abstractContent = [];
let nxt = h1;
Expand Down

0 comments on commit 716eaae

Please sign in to comment.