Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
feat: Add a default style for built-in property "tags".
Browse files Browse the repository at this point in the history
  • Loading branch information
jjaychen1e authored and peanball committed Jun 30, 2023
1 parent 74bd305 commit ce07403
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,17 @@ async function main() {
let value = "";
if (propertyName in properties) {
value = properties[propertyName]
if (propertyName === "tags" && formatTemplate === undefined) {
const htmlTemplate = '<a data-ref="${pageName}" class="tag">#${pageName}</a>'
const separatorSpanTemplate = '<span> </span>'
if (Array.isArray(value)) {
value = `<div>${value.map((tag) => {
return htmlTemplate.replaceAll("${pageName}", tag)
}).join(separatorSpanTemplate)}</div>`
} else {
value = htmlTemplate.replaceAll("${pageName}", value)
}
}
template = template.replace(`$${propertyName}`, value)
}
console.info(propertyName, template)
Expand Down

0 comments on commit ce07403

Please # to comment.