feat(primitive): markdown -- extract frontmatter, code blocks, commands, patterns #23

Closed
opened 2026-05-24 17:09:58 +02:00 by michael · 0 comments
Owner

Goal

New primitive to extract structured content from Markdown files.
Basis for all article validation in the daw-article pack.

Capabilities

primitive_id: daw.fragjan.check.markdown
capabilities:
  filesystem: read
  process: false
  network: false

Extraction targets

  • Frontmatter fields (YAML between ---)
  • Code blocks by tag (bash, untagged, any)
  • Inline patterns (sysctl names, paths, commands via regex)
  • Commands from bash blocks (lines starting with $)

Parameters

extract:
  type: frontmatter_field | code_blocks | pattern | commands
  tag: bash          # for code_blocks: filter by language tag
  pattern: string    # for pattern extraction
  field: string      # for frontmatter_field

Output (metrics)

# frontmatter_field
found: boolean
value: string

# code_blocks
blocks: list of { tag, content, line }

# pattern / commands
matches: list of { value, line }
match_count: integer

Future scope (not now)

  • Extract expected output from bash blocks (lines without $ prefix)
  • Compare expected vs actual output

Acceptance criteria

  • Frontmatter fields extractable by name
  • Code blocks filterable by tag
  • Commands extractable from bash blocks (strip $ prefix)
  • Pattern extraction returns line numbers
  • Returns empty result (not error) when nothing found
  • Tests in test/
## Goal New primitive to extract structured content from Markdown files. Basis for all article validation in the daw-article pack. ## Capabilities ```yaml primitive_id: daw.fragjan.check.markdown capabilities: filesystem: read process: false network: false ``` ## Extraction targets - Frontmatter fields (YAML between `---`) - Code blocks by tag (`bash`, untagged, any) - Inline patterns (sysctl names, paths, commands via regex) - Commands from bash blocks (lines starting with `$`) ## Parameters ```yaml extract: type: frontmatter_field | code_blocks | pattern | commands tag: bash # for code_blocks: filter by language tag pattern: string # for pattern extraction field: string # for frontmatter_field ``` ## Output (metrics) ```yaml # frontmatter_field found: boolean value: string # code_blocks blocks: list of { tag, content, line } # pattern / commands matches: list of { value, line } match_count: integer ``` ## Future scope (not now) - Extract expected output from bash blocks (lines without `$` prefix) - Compare expected vs actual output ## Acceptance criteria - [ ] Frontmatter fields extractable by name - [ ] Code blocks filterable by tag - [ ] Commands extractable from bash blocks (strip `$` prefix) - [ ] Pattern extraction returns line numbers - [ ] Returns empty result (not error) when nothing found - [ ] Tests in test/ ## Related - DAW/fragjan#24 (article command -- uses this primitive) - DAW/fragjan#25 (daw-article pack -- uses this primitive)
michael added this to the Basic Version milestone 2026-05-30 16:05:10 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/fragjan#23
No description provided.