---
id: 2026-02-02T06:50:00-05:00
aliases: []
title: 2026-02-02 06:50:00
tags:
  - authorship/original
  - destiny/permanent
  - status/draft
  - topic/meta
  - type/timestamped
daily: "[[2026-02-02]]"
dg-publish: true
---
# 2026-02-02 06:50:00

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 match expression is bizarre,
and the whole thing needs better error handling,
but it works.

A `Where-Markdown` for filtering by tags
and a `{Verb}-Markdown` for modifying tags
would be idiomatic.
