📋 常用标签

const allPages = dv.pages();
const tagCounts = {};
allPages.forEach(page => {
  if (page.file && page.file.tags) {
    page.file.tags.forEach(tag => {
      tagCounts[tag] = (tagCounts[tag] || 0) + 1;
    });
  }
});
const sortedTags = Object.entries(tagCounts).sort((a,b) => b[1]-a[1]).slice(0, 20);
dv.paragraph(sortedTags.map(([tag, count]) => `#${tag.slice(1)}(${count})`).join('  ·  '));