Skip to content

Allow for parsing hints in space config #44

Open

Description

@mindsocket

A specific expression of a space may contain structures or terminology that doesn't match exactly with a defined schema.

One way around that, without forcing the content to adapt, would be to support some kind of parsing hints in space config.

We need to collect concrete examples but conceptually this could include:

  • files in path x have type y
  • heading x on page y is an embedded z node
  • the nth bulleted list in page x is a list of y nodes
  • page titles should be normalised by regex /x/y/
  • the y in x:y tag maps to property z

Could potentially use jsonata and/or selectors for this.

Activity

  1. mindsocket commented on Apr 6, 2026

    @mindsocket
    OwnerAuthor

    Updating scope based on work on #72 (knowledge wiki) and #78 (metadata layout).

    The first bullet — files in path x have type y — is now the most immediately useful parsing hint. Two knowledge wiki spaces have been configured using the same knowledge_wiki schema. Right now they rely on schema-level aliases for type resolution, but folder-to-type mapping at the space config level would be cleaner.

    This could take the form:

    {
      "name": "my-wiki",
      "path": "...",
      "schema": "knowledge_wiki.json",
      "plugins": {
        "markdown": {
          "typeInference": {
            "fromFolder": true,
            "overrides": { "Research": "source", "Personal": "note" }
          }
        }
      }
    }

    Where fromFolder: true auto-maps folder names to type names (matching on type name, aliases, or matchers from the schema), and overrides handle cases where folder names don't match.

    This connects to #73 (type inference from folder structure) which proposes this as a plugin-level config, and #78 which discusses separating type configuration from relationships in the schema metadata.

    Also noting the other hint types (embedded nodes from headings, normalising titles) can stay low priority — they're useful but less immediately needed.

  2. mindsocket commented on Nov 30, 2026

    @mindsocket
    OwnerAuthor

    Status update

    A good portion of the parsing hints discussed here are now implemented under plugins.markdown in space config (see docs/config.md and src/plugins/markdown/index.ts):

    • Folder-to-type mapping: typeInference supports mode: "folder-name" | "off" (default folder-name, matching leaf folder names against schema types/aliases) and folderMap (explicit folder-prefix overrides, including "." for the space root and "*" as a fallback). This covers the April 2026 scope.
    • Field remapping: fieldMap remaps source property names to canonical schema fields across frontmatter, inline fields, YAML blocks, and table columns (including remapping a custom title field to title).
    • Index page titles: folderIndex derives a display title from the containing folder name for configured index basenames (e.g. Overview, index).
    • Embedded node extraction: embedded enables per-enclosing-type (or "*") extraction of plain headings (with type, minDepth, maxDepth), lists, tables, and fenced yamlBlocks, complementing schema-level `` matchers.

    What remains (if still wanted)

    • Path/glob include/exclude & filename-based type inference: currently readSpaceDirectory reads all non-dot **/*.md files (skipping templateDir), and folderMap matches folder prefixes rather than arbitrary globs or filename patterns.
    • Space-config heading/section matchers: mapping a specific heading on a specific page/type to an embedded type (currently matchers only live in schema ``).
    • Positional selectors: e.g. "the nth bulleted list in page X is a list of Y nodes".
    • Regex title normalisation: beyond folderIndex and fieldMap -> title.
    • Tag-to-property mapping: e.g. extracting x:y tags into a schema field z.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions