Skip to content

Conversion Rules

  1. Parse YAML frontmatter as structured data
  2. Map frontmatter properties to JSON-LD using context
  3. Parse Markdown content for:
    • Wiki-links → relationships array
    • Entity references (@[[…]]) → entities array
    • Block references (^id) → fragment identifiers
  4. Convert body content to content field
  1. Generate YAML frontmatter from JSON-LD properties
  2. Set first title or H1 from dc:title
  3. Convert content to Markdown body
  4. Append ”## Relationships” section from relationships
  5. Append ”## Entities” section from entities
  6. Convert @id URIs to wiki-links

Input (JSON-LD):

{
"@context": "https://mif-spec.dev/schema/context.jsonld",
"@type": "Memory",
"@id": "urn:mif:550e8400",
"title": "Dark Mode",
"content": "User prefers dark mode",
"relationships": [
{"relationshipType": "RelatesTo", "target": {"@id": "urn:mif:ui-prefs"}}
]
}

Output (Markdown):

---
id: 550e8400
type: semantic
title: Dark Mode
---
# Dark Mode
User prefers dark mode
## Relationships
- relates-to [[ui-prefs]]

Markdown to JSON-LD:

  1. Parse frontmatter citations array
  2. For each citation:
    • Map typecitationType vocabulary term
    • Map rolecitationRole vocabulary term
    • Resolve @[[Entity|Type]] author refs → entity URIs
    • For multiple authors (comma-separated), convert to array of author objects
    • Convert dates to ISO 8601 format
  3. If ## Citations body section exists:
    • Parse markdown links for title/url
    • Extract metadata from **Key**: value patterns
    • Merge with frontmatter (frontmatter takes precedence)
  4. Build Citation objects array

JSON-LD to Markdown:

  1. Generate frontmatter citations array from JSON-LD
  2. Convert entity URIs to wiki-link syntax
  3. If any citation has note exceeding 100 characters:
    • Create ## Citations body section
    • Format as markdown list with metadata

Example:

# Frontmatter
citations:
- type: article
title: "Research Paper"
url: https://example.com/paper
role: supports
author: "@[[Jane Smith|Person]]"

Converts to:

"citations": [{
"@type": "Citation",
"citationType": "article",
"citationRole": "supports",
"title": "Research Paper",
"url": "https://example.com/paper",
"author": {
"@type": "EntityReference",
"entity": {"@id": "urn:mif:entity:person:jane-smith"}
}
}]