pi-mdxml-context
Pi extension that converts Markdown context to XML-like structure at model send time
Package details
Install pi-mdxml-context from npm and Pi will load the resources declared by the package manifest.
$ pi install npm:pi-mdxml-context- Package
pi-mdxml-context- Version
0.1.12- Published
- Jul 20, 2026
- Downloads
- 1,226/mo · 190/wk
- Author
- eiei114
- License
- MIT
- Types
- extension
- Size
- 45.2 KB
- Dependencies
- 4 dependencies · 0 peers
Pi manifest JSON
{
"extensions": [
"./index.ts"
]
}Security note
Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.
README
pi-mdxml-context
Convert Markdown context to XML-like structure at model send time while keeping the original Markdown in session history.
What this is
pi-mdxml-context is a Pi extension for agent workflows where Markdown is convenient for humans, but explicit XML-like boundaries can make complex context easier for models to parse.
It converts loaded Markdown context files and recent Markdown tool results before each model request. Saved session history stays in Markdown; conversion happens only in the provider-bound context.
Features
- Converts Markdown context files before model requests.
- Converts Markdown tool results without mutating saved session history.
- Preserves source metadata on the generated XML root element.
- Supports frontmatter, GFM, code blocks, tables, wikilinks, and Obsidian-style callouts.
- Provides preview and on/off toggle commands.
- Skips conversion when XML output grows too large.
Install
Install the published npm package with Pi:
pi install npm:pi-mdxml-context
Pin a specific version when you want reproducible installs:
pi install npm:pi-mdxml-context@0.1.9
Install into the current project instead of your user Pi settings:
pi install npm:pi-mdxml-context -l
Or install from GitHub:
pi install git:github.com/eiei114/pi-mdxml-context
Try it without permanently installing:
pi -e npm:pi-mdxml-context
Quick start
After install, reload Pi if needed:
/reload
Check that conversion is active:
/mdxml:status
Preview XML-like output for a Markdown file:
/mdxml:preview path/to/file.md
For commands, output shape, runtime hooks, and safety behavior, see docs/usage.md.
Usage summary
| Command | Description |
|---|---|
/mdxml:on |
Enable send-time conversion. |
/mdxml:off |
Disable send-time conversion. |
/mdxml:status |
Show conversion state and recent stats. |
/mdxml:preview <path> |
Preview XML-like output for a Markdown file. |
/mdxml:preview recent:N |
Preview XML-like output for a recent Markdown tool result. |
Conversion is enabled by default after the extension loads. Use /mdxml:off to disable it immediately.
Package contents
| Path | Purpose |
|---|---|
index.ts |
Pi TypeScript extension entrypoint |
tests/ |
Converter, runtime hook, and preview tests |
docs/ |
Usage and release docs (usage.md, release.md) |
README.md |
Public entrypoint (this file) |
CHANGELOG.md |
Version history |
CODE_OF_CONDUCT.md |
Contributor Covenant code of conduct |
CONTRIBUTING.md |
Contribution guidelines |
SECURITY.md |
Vulnerability reporting |
LICENSE |
MIT license |
Development
npm install
npm run check
npm test
Before opening a PR with publishable changes, bump package.json and update CHANGELOG.md in the same PR. CI runs npm run version:check on pull requests.
Release
This package uses npm Trusted Publishing with GitHub Actions OIDC — no NPM_TOKEN is required.
On main, a version bump in package.json triggers Auto Release, which creates the semver tag and GitHub Release, then dispatches Publish to npm (publish.yml).
See docs/release.md for setup details and tag-to-npm verification steps. See CHANGELOG.md for semver history.
Security
Pi packages run with your local permissions. Review extensions before installing third-party packages.
For vulnerability reporting, see SECURITY.md.
Links
- npm: https://www.npmjs.com/package/pi-mdxml-context
- GitHub: https://github.com/eiei114/pi-mdxml-context
- Issues: https://github.com/eiei114/pi-mdxml-context/issues
- Roadmap: ROADMAP.md
License
MIT