4.2 KiB
Obsidian Literature Maintenance
Use this reference when working inside the user's Obsidian vault literature area:
C:\Users\qyh15\Documents\Obsidian Vault\01 文献阅读
Empty AI Note Cleanup
Target folder:
01 文献阅读\00 AI总结笔记
Definition of an empty note:
- Markdown file under the target folder.
- After removing YAML frontmatter, standalone
---separators, whitespace, ,<br>, empty<p></p>, and HTML comments, there is no body content. - A note with any real summary, heading, bullet, Zotero link, DOI text, or manual annotation is not empty.
PowerShell dry-run pattern:
$dir = '01 文献阅读\00 AI总结笔记'
$empty = @()
Get-ChildItem -LiteralPath $dir -File -Filter '*.md' | ForEach-Object {
$text = [System.IO.File]::ReadAllText($_.FullName)
$body = $text -replace '^\uFEFF',''
$body = [regex]::Replace($body, '(?s)^\s*---\r?\n.*?\r?\n---\s*', '')
$body = [regex]::Replace($body, '(?m)^\s*---\s*$', '')
$body = [regex]::Replace($body, ' |<br\s*/?>|<p>\s*</p>|<!--.*?-->', '', 'Singleline')
if ([string]::IsNullOrWhiteSpace($body)) { $empty += $_ }
}
$empty | Select-Object Name,Length
'EMPTY_COUNT=' + $empty.Count
Delete only after inspecting the dry-run count and at least a few representative files:
$empty | ForEach-Object { Remove-Item -LiteralPath $_.FullName }
After deletion, rerun the dry-run scan and confirm EMPTY_COUNT=0.
Dataview Dashboard Folder
Default dashboard folder:
01 文献阅读\01 Dataview文献看板
Recommended files:
00 文献总览.md: journal distribution, recent updates, missing rating/status.01 按期刊分类.md: journal count ranking, one-row-per-paper detail table, high-impact journals, missing journal.02 驱动器相关.md: actuator/robotic/soft robotics keyword views.03 综述与进展类.md: review/recent/advances/progress/emerging/fundamentals/current/strategies views.04 按年份分类.md: year grouping and count summaries.05 材料与关键词分类.md: MXene, MOF, hydrogel/organogel/ionogel, cellulose/PVA/polymer, TENG.06 DOI明细.md: DOI-heavy views separated from the main dashboard to avoid wide tables.
Dataview source path:
FROM "01 文献阅读/00 AI总结笔记"
Use TABLE WITHOUT ID for cleaner tables.
Avoid this pattern for visual dashboards:
TABLE rows.file.link AS 文章
GROUP BY journal
It creates one huge list per table cell and makes journal rows look sparse. Prefer:
TABLE WITHOUT ID
key AS 期刊,
length(rows) AS 篇数
FROM "01 文献阅读/00 AI总结笔记"
WHERE contains(tags, "literature") AND journal
GROUP BY journal
SORT length(rows) DESC, key ASC
Then add a separate detail table:
TABLE WITHOUT ID
file.link AS 文章,
journal AS 期刊,
year AS 年份
FROM "01 文献阅读/00 AI总结笔记"
WHERE contains(tags, "literature") AND journal
SORT journal ASC, year DESC, file.name ASC
Dataview Table Width
Keep main dashboard tables narrow. Put wide fields such as DOI, authors, and file modification times into separate detail pages.
Optional CSS snippet:
.obsidian\snippets\literature-dataview.css
Recommended behavior:
table-layout: fixedwidth: 100%- wrap long cell text with
overflow-wrap: anywhere - first column about
42%, second about28%, third about10%
Enable the snippet in .obsidian/appearance.json with:
"enabledCssSnippets": [
"literature-dataview"
]
If Obsidian does not pick it up immediately, use Settings > Appearance > CSS snippets > Refresh or restart Obsidian.
Rendering Troubleshooting
If Dataview blocks show as code:
- Confirm the Dataview community plugin is installed and enabled.
- Switch from editing/live-preview into reading view if needed.
- Reopen the note or restart Obsidian.
- A real Dataview syntax issue usually shows an error, not a raw code block.
Encoding Caution
Some older generated notes may display mojibake in PowerShell output or Obsidian if the original generation used the wrong encoding. Do not bulk rewrite those notes unless the user asks for text repair. Dataview dashboards should primarily rely on frontmatter fields and file names until encoding is repaired.