# ChatGPT DIL Local Render supported ChatGPT interactive diagrams and charts in Obsidian, offline. Import a Markdown export containing raw DIL tags, and the plugin creates a compatible companion note while preserving the original file. **Independent community project. Not affiliated with OpenAI or Obsidian.** DIL support is based on an MIT compatibility implementation; this is not the official ChatGPT renderer, and pixel-identical output or universal support is not promised. ## 中文使用说明 1. 安装并启用插件。 2. 把从 ChatGPT 导出的 `.md` 放进 Obsidian 仓库;也可以用命令面板中的 **ChatGPT DIL Local: Import ChatGPT Markdown / 导入 Markdown**,一次选择多个文件。 3. 插件检测到 ``、``、`{@body ...}` 等原始 DIL 内容后,会生成并打开同目录的 **`原文件名 · DIL.md`**。使用阅读视图查看和操作图表。 4. 原文件保留。再次打开相同文件会复用已有交互版;原文件更新后,仅在生成笔记未被手动修改时更新它,否则另建文件。 5. 已存在的笔记也可以打开后自动转换,或用 **Convert current note / 转换当前笔记** 命令处理。设置里可以关闭自动识别或自动打开。 **图片与附件:** 请把导出的图片和附件一起复制进仓库,并保留 Markdown 的相对路径。插件不会访问你的 ChatGPT 账号,也无法从只有“附件名称”的导出中恢复未下载的文件。如果附件名称对应的图片文件就在笔记同目录,会自动补上图片嵌入。文件选择器只导入所选 Markdown,不会自动复制电脑上未选择的附件目录。 ## Install Requires **desktop Obsidian 1.12.7 or newer**. Mobile is not supported. ### Manual install 1. Download `chatgpt-dil-local.zip` from [Releases](https://github.com/xueh0635-design/chatgpt-dil-local/releases). 2. Extract its `chatgpt-dil-local` folder into `/.obsidian/plugins/`. 3. Reload Obsidian. In **Settings → Community plugins**, enable **ChatGPT DIL Local**. The release also provides `main.js`, `manifest.json`, and `styles.css` individually. Those three files are all that is needed at runtime. No Node.js installation, API key, subscription, or export quota is involved in this plugin. ### BRAT Add `xueh0635-design/chatgpt-dil-local` in BRAT, then enable the plugin. Community directory submission status is tracked separately from GitHub releases; a release does not itself mean the plugin is available in Obsidian's built-in search. ## How it works - Detects newly imported or opened Markdown containing supported raw DIL tags. - Wraps actual DIL components in `chatgpt-dil` fenced blocks and translates `\[...\]` / `\(...\)` equations outside code into Obsidian math delimiters. - Leaves existing code fences, inline code, ordinary HTML tables, and already-converted notes alone. - Renders each component in a sandboxed iframe with **`allow-scripts` only**. Model-authored expressions execute in a Worker inside that frame, not in Obsidian's host JavaScript context. - The frame's Content Security Policy blocks network requests. Scripts, styles, KaTeX fonts, and the renderer are bundled for offline use. External media inside a DIL frame is deliberately not loaded. - Preserves interaction state locally in the plugin's `data.json`. There is no telemetry, remote service, or self-updater. - Loads frames near the viewport and releases offscreen Workers, so long conversations do not start hundreds of active sandboxes at once. - Normal Markdown image/link behavior is still controlled by Obsidian. As with other desktop plugins, the plugin itself has host application permissions; iframe isolation is not a claim that the plugin has no vault access. ## Supported scope and limitations Layouts, text, cards, charts, equations, basic SVG, sliders, segmented controls, and related DIL primitives are supported by the compatibility renderer. Chart styling, axes, tooltips, and layout may differ from ChatGPT. Unknown components show a warning; source code remains editable. Malformed or incomplete root components are left intact. `LearningViz` supports the `ABSOLUTE_VALUE_DISTANCE` type: a draggable number line, a keyboard-accessible slider, and live absolute-value/distance output. Other `type_id` values produce an explicit unsupported-component warning. `Graph` supports bounded `y=f(x)` expressions with arithmetic, powers, fractions, `sqrt`, `erf`, `abs`, `sin`, `cos`, `tan`, `exp`, `ln`, `log`, `min`, and `max`. Its offline plot supports zoom, curve toggles, and value inspection. Formulas are parsed with a small mathematical grammar rather than evaluated as JavaScript; unknown syntax is rejected explicitly. `erf` uses a numerical approximation. This is sufficient for the exported GELU/ReLU comparison, not a complete replacement for a general graphing calculator or ChatGPT's full widget library. `WritingBlock` document wrappers are unwrapped into normal Markdown. Missing attachment files and generated-image placeholders produce an explicit warning at the top of the imported note. The exporter must include the actual DIL source. Screenshots, PDF files, missing source data, expiring image URLs, and attachment names alone cannot reconstruct original interactivity. PDF exports remain static. The current importer handles raw DIL roots, not every possible future ChatGPT format or arbitrary HTML applications. Automatic import creates a separate note and does not rewrite the original. It does not scan and convert the whole vault on startup. Repeated opens are deduplicated; edits to generated notes are preserved by creating another copy when necessary. ## Try without private data Copy [`demo/example.md`](demo/example.md) into a vault with this plugin enabled. It contains a synthetic BCE slider and bar chart. Change the probability from **90%** to **10%**: the displayed loss changes from **0.105** to **2.303**. A fenced HTML example remains literal code. ## Build and verify ```sh npm ci --ignore-scripts npm test ``` The build creates `main.js` and `dist/`. Test coverage includes code-fence protection, preservation of ordinary Markdown, idempotent conversion, state-declaration association, and import file safety. No private chat samples are committed. ## Attribution and license MIT. Compiler, Worker, DOM renderer, and base styles are adapted from [Disdjj/intelligent-ui-demo](https://github.com/Disdjj/intelligent-ui-demo), revision `33297b8629c82fa5b7cc15dcd157ce90821463f3`, copyright 2026 DJJ. Local importer, Obsidian integration, sandbox packaging, equation and SVG extensions are by this project. KaTeX is MIT licensed. See [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md) and [LICENSE](LICENSE).