vault backup: 2026-02-02 06:58:10

This commit is contained in:
2026-02-02 06:58:10 -05:00
parent c6e02db4b9
commit 1f45ee3e7d
9 changed files with 533 additions and 3 deletions
+61
View File
@@ -0,0 +1,61 @@
---
id:
aliases: []
title: 2026-02-02
tags:
- authorship/original
- destiny/permanent
- status/draft
- type/daily
dg-publish: true
---
# 2026-02-02
## 2026-02-02 06:50
I'm considering including management scripts in this vault,
but I'd generally prefer to keep it content only.
Ideally I could do anything I'd use a script for with a plugin,
but they have their limitations.
Eventually I should [[learn-to-write-obsidian-plugins]],
but for now here's a useful cmdlet I wrote a while ago but misplaced.
```powershell
function Import-Markdown {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string]$Path
)
try {
$command = Get-Command ConvertFrom-Yaml -ErrorAction "Stop"
}
catch {
throw "no YAML conversion module installed. Try ``Install-Module powershell-yaml``."
}
$content = Get-Content -Path $Path -Raw
$pattern = [Regex]'(?ms)^---\s*(.*?)\s*---\s*(.*)$'
$match = $pattern.Match($content)
if ($match.Success) {
$frontmatter = $match.Groups[1].Value
$body = $match.Groups[2].Value
}
else {
$frontmatter = ''
$body = $content
}
return [pscustomobject]@{
frontmatter = $frontmatter | ConvertFrom-Yaml
body = $body
}
}
```
That pattern is bizarre, and it needs better error handling,
but it works.
A `Where-Markdown` for filtering by tags
and a `{Verb}-Markdown` for modifying tags
would be idiomatic.