Skip to content

Releases: foo-ogawa/embedoc

v0.11.0

03 Mar 02:28

Choose a tag to compare

Changes

Custom Datasource Types

  • New defineDatasource() API for creating custom datasource types in TypeScript
  • Custom types are loaded from .embedoc/datasources/index.ts and usable in embedoc.config.yaml
  • DatasourceConfig.type now accepts arbitrary strings (not limited to built-in types)

Custom Inline Format Parsers

  • Export inlineFormats from .embedoc/datasources/index.ts to register custom parsers
  • Custom formats work with @embedoc-data markers (e.g., format="toml")

.embedoc/ Directory Structure

  • All custom code now defaults to .embedoc/ subdirectory:
    • .embedoc/renderers/ (was ./embeds/)
    • .embedoc/datasources/ (new)
    • .embedoc/templates/ (was ./templates/)

embedoc init Command

  • New embedoc init command scaffolds project structure
  • Creates embedoc.config.yaml, .embedoc/ directories with starter files
  • Adds embedoc:build, embedoc:watch, embedoc:generate scripts to package.json
  • Supports --force to overwrite existing files

Renames (backward compatible)

  • EmbedifyConfig -> EmbedocConfig (old name exported as deprecated alias)
  • embeds_dir -> renderers_dir config key (old key still works with deprecation warning)

Internal

  • createDatasource() / initializeDatasources() are now async
  • 7 new unit tests (159 total)

v0.10.2

01 Mar 03:03

Choose a tag to compare

What's New

format="js" support for inline datasources

Inline data blocks can now use format="js" to define data as JavaScript object literals, including template literal strings.

/*@embedoc-data:prompts format="js"*/{
  greeting: `Hello,
world!`,
  nested: {
    value: `multi-line
template literal`
  }
}/*@embedoc-data:end*/

This is useful when embedding data in TypeScript/JavaScript source files where strict JSON (double-quoted strings, no trailing commas) is impractical. The JS expression is evaluated at build time via new Function().

v0.10.1

14 Jan 09:33

Choose a tag to compare

Changes

New Features

  • Existing content preservation: Return null or undefined from render() to keep existing content unchanged
  • ctx.existingContent: Access the current content between markers for conditional logic

Use Case

Graceful degradation when external data sources (databases, APIs) are unavailable:

async render(ctx) {
  try {
    const data = await fetchFromDatabase(ctx.params['id']);
    return { content: formatData(data) };
  } catch (error) {
    // On error, keep existing content
    return { content: null };
  }
}

Documentation

  • Added "Error Recovery / Graceful Degradation" section to README
  • Updated type definitions for EmbedContext and EmbedResult

v0.10.0

13 Jan 14:05

Choose a tag to compare

New Features

Inline Datasource Location Metadata

  • getMeta(propertyPath?) - Get definition location for a specific property
  • getAllMeta() - Get all definition locations as an array
  • Automatically calculates relativePath from target document

Inline Marker Attribute

  • inline="true" attribute suppresses newlines around generated content
  • Essential for embedding values within Markdown tables

Bug Fixes

  • Fixed frontmatter line offset calculation for accurate line numbers

Documentation

  • Updated README.md with Location Metadata and Inline Mode sections
  • Updated API documentation with InlineDatasource details

v0.9.2

10 Jan 06:27

Choose a tag to compare

Bug Fixes

  • fix: handle tsImport returning module.default.embeds (#89d8986)
    • TypeScriptエンベッドファイルのインポートで、module.default.embeds形式を正しくハンドリングするよう修正

v0.9.1

08 Jan 00:06

Choose a tag to compare

What's Changed

Features

  • Add Embed API documentation with typedoc
  • Add npm workspaces support for examples directory
  • Enhanced TSDoc comments for all Embed API types

Documentation

  • Add docs/api/README.md with detailed API reference
  • Add link to API documentation in main README
  • Include docs directory in npm package

Developer Experience

  • Update examples/embeds imports to use 'embedoc' package name
  • Add npm run docs command for documentation generation

API Reference

Detailed documentation for:

  • defineEmbed function
  • EmbedDefinition interface
  • EmbedContext interface
  • EmbedResult interface
  • Datasource interface
  • MarkdownHelper interface
  • QueryResult type

Full Changelog: v0.9.0...v0.9.1

v0.9.0 - Initial Release

05 Jan 08:04

Choose a tag to compare

🎉 Initial Release - embedoc

Features

  • In-place document generation: Auto-update marker blocks while preserving manual edits
  • Multiple comment styles: HTML, block, line, hash, SQL comments supported
  • Datasources: SQLite, CSV, JSON, YAML, glob file patterns
  • Programmable embeds: TypeScript/JavaScript functions with defineEmbed API
  • Inline datasources: Define data directly in documents with @embedoc-data markers
  • Dot-path access: Navigate nested data structures (e.g., project.author.name)
  • Code fence support: Write inline data in fenced code blocks for syntax highlighting
  • File generation: Generate multiple files from datasource records using Handlebars templates
  • Watch mode: Monitor file changes with incremental rebuilds
  • Dependency tracking: Smart rebuilds based on document-embed-datasource relationships
  • Frontmatter support: YAML metadata accessible by embeds
  • Markdown helpers: Built-in functions for tables, lists, code blocks, links, etc.

CLI Commands

  • embedoc build - Process all target files
  • embedoc watch - Watch mode with live reload
  • embedoc generate - Generate files from datasources
  • embedoc deps - Analyze dependency graph

Requirements

  • Node.js >= 18.0.0