add rdfa for breadcrumbs
This commit is contained in:
parent
7803b495c2
commit
859064f00b
@ -41,16 +41,19 @@ export function breadcrumb_nav_ext(renderer: marked.Renderer, opts: MarkdownOpti
|
|||||||
},
|
},
|
||||||
renderer(token: BreadcrumbNavToken) {
|
renderer(token: BreadcrumbNavToken) {
|
||||||
return `<nav aria-label="breadcrumbs" ${token.attrs.html_attrs.join(' ')}>\n`
|
return `<nav aria-label="breadcrumbs" ${token.attrs.html_attrs.join(' ')}>\n`
|
||||||
+ `\t<ol>\n`
|
+ `\t<ol vocab="https://schema.org/" typeof="BreadcrumbList">\n`
|
||||||
+ '\t\t'
|
+ '\t\t'
|
||||||
+ token.items.map((tokens, index) =>{
|
+ token.items.map((tokens, index) =>{
|
||||||
let item = '<li>';
|
let item = '<li property="itemListElement" typeof="ListItem">\n';
|
||||||
|
|
||||||
if (index) {
|
if (index) {
|
||||||
item += '<span class="separator" aria-hidden="true">/</span> ';
|
item += '\t\t\t<span class="separator" aria-hidden="true">/</span>\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
return item + this.parser.parseInline(tokens, renderer) + '</li>';
|
item += `\t\t\t<span property="name">${this.parser.parseInline(tokens, renderer)}</span>\n`;
|
||||||
|
item += `\t\t\t<meta property="position" content="${index + 1}">\n`;
|
||||||
|
|
||||||
|
return item + + '\t\t</li>';
|
||||||
}).join('\n\t\t')
|
}).join('\n\t\t')
|
||||||
+ '\n'
|
+ '\n'
|
||||||
+ `\t</ol>\n`
|
+ `\t</ol>\n`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user