dsh-pptx-builder
界面增强 活跃维护

dsh-pptx-builder

ZhdanovDmitriy/dsh-pptx-builder

项目摘要: 提供粉彩风格幻灯片模板,内置 Python 图表渲染与代码卡片组件,带 Presentations 演示模式,直接输出结构完整的 PPTX 文件,写代码时顺手出稿。

0
Stars 标星
0
Forks 分支
0
Watchers 关注
0
Open Issues
JavaScript
主要语言
MIT
开源协议
506 KB
仓库大小
1 个月前
最后推送
一键安装扩展 / 插件指令
dsh plugin --profile web add github:ZhdanovDmitriy/dsh-pptx-builder
git clone https://github.com/ZhdanovDmitriy/dsh-pptx-builder.git
git clone git@github.com:ZhdanovDmitriy/dsh-pptx-builder.git
README.md main

PowerPoint Builder for DeepSeek Harness

A plugin bundle that lets an agent build real Microsoft PowerPoint decks: pastel
palettes, ten reusable slide templates with exact geometric centering, styled
text boxes, internet images, charts rendered by Python, highlighted code cards,
and LaTeX formulas — matrices, integrals, sums with limits — typeset by the
plugin itself, with no LaTeX installation. It also ships a Presentations
agent mode tuned for deck work.

The .pptx package (ZIP + OOXML) is written by the plugin itself, so there is
no Office dependency, no network round-trip after an image is embedded, and the
file stays valid after every call.

Install

Install the bundle into the current profile:

plugin_manager { "action": "install_bundle", "target": "dsh-pptx-builder" }

Or use Plugins → Install in the Harness UI and paste the package name.
After a restart the tools show up in every mode, and a new Presentations
agent preset appears in the mode picker for a new session.

From a local checkout, pass the absolute directory instead of the package name.

Presentations mode

The preset adds a persona that knows the workflow — inspect before editing,
build from templates, cite data sources, typeset mathematics with
pptx_add_math, finish with present — plus a focused toolset: the pptx_*
tools, file reading, web search/fetch, present, todo_write,
ask_user_question, and compaction. The tools themselves are registered
host-wide, so they are also usable outside this mode.

Tools

Tool What it does
pptx_create Creates a deck on a pastel palette: size (16:9 / 4:3), palette, default font, accent, page-number placement.
pptx_gallery Builds a ready-made reference deck: features tours every template, alignment, list style and chart kind; showcase is a polished business deck.
pptx_add_slide Adds a slide from a template (title, section, content, split-left, split-right, chart, code, closing, blank) with a heading, text, presenter and photo.
pptx_add_text Arbitrary text box: role, x/y/w/h, font_size/font_face/bold/italic/underline/color/align/valign/bullet.
pptx_add_image Downloads an image by url (or reads a local path), embeds the bytes and places it; the aspect ratio is preserved.
pptx_add_chart Renders a chart from data (bar, stacked bar, line, area, pie, donut) with Python and embeds it.
pptx_add_code Renders a code snippet as a dark card with syntax highlighting, line numbers, a file-name header and highlighted lines.
pptx_add_math Typesets a LaTeX formula — matrices, integrals, sums with limits, fractions, Greek letters — and embeds it as a crisp transparent picture.
pptx_update_element Moves, resizes, restyles, retypes or replaces an existing element by id.
pptx_remove Deletes one element by id, or a whole slide by its 1-based number.
pptx_inspect Lists the template, palette and every element with ids, geometry in inches, text, fonts and sources.

Coordinates are inches from the top-left corner of the slide (16:9 is
13.333 × 7.5), font sizes are points, colours are #RRGGBB, a basic colour
name, or a palette keyword (ink, muted, accent, background).

Templates

Template Layout
title Oversized centred heading, subtitle below, presenter line in the bottom-right corner. Page number off.
section Divider: heading and subtitle centred on the slide.
content Centred heading on top, a fixed-width text column underneath.
split-right Photo fitted and centred in the right half; heading and text centred in the left half.
split-left Mirrored: photo on the left, text on the right.
chart Heading and caption on top, the lower two thirds reserved for pptx_add_chart.
code Heading and subtitle on top, the rest reserved for pptx_add_code.
math Heading and subtitle on top, an optional statement under them, the rest reserved for pptx_add_math.
closing Large centred "Спасибо за внимание" (override with title), optional subtitle.
blank Nothing but the background.

Every template centres its content inside its own region: the photo in its half,
the heading and text in theirs, blocks centered vertically.

Palettes

pptx_create takes palette: sand (default), mint, lavender, sky,
rose. A palette defines the pastel background of every slide, the body ink,
the muted secondary colour, the accent, and the chart series colours.

Alignment and lists

Alignment and text shape are parameters, not template defaults:

Parameter Values
align left, center, right, justify for the text block
title_align the same for the heading and subtitle
bullet true for a bulleted list, false (default) for one solid block

Defaults: content is left-aligned, split-left / split-right are centred
without bullets and left-aligned with them. Long lists read best on the left;
centred or right-aligned text suits short lines and single paragraphs. An
existing block can be re-aligned with pptx_update_element (align, bullet).

Charts

pptx_add_chart accepts data, not code:

{ "file": "sales.pptx", "kind": "bar", "stacked": false,
  "categories": ["2021", "2022", "2023", "2024"],
  "series": [ { "name": "Revenue", "values": [10.2, 13.8, 17.1, 21.4] } ],
  "y_label": "bn RUB", "value_format": "auto",
  "source": "Source: annual reports, 2025" }

Supported: bar (including stacked), line, area, pie, donut. The
renderer draws the palette background, a light grid, axis labels, a legend,
value labels and a source footnote. The image is 1800 × 1000 px and is embedded
into the deck.

Data pipeline: web_search / web_fetch find the numbers, the model puts them
into categories and series, pptx_add_chart draws the picture, and
pptx_update_element can move or resize it.

Code cards

pptx_add_code renders a snippet into a dark rounded card — syntax
highlighting, line numbers, a file-name header, a language chip, and an accent
band on highlighted lines — and embeds it as a picture.

pptx_add_slide { "file": "d.pptx", "template": "code",
                 "title": "How we measure", "subtitle": "python · pandas" }
pptx_add_code  { "file": "d.pptx", "language": "python", "title": "metrics.py",
                 "highlight_lines": [5, 6], "code": "import pandas as pd\n..." }

Languages: python, javascript, typescript, json, bash, sql, text.
Keep lines under ~90 characters and the snippet under 60 lines: the card scales
as a whole, so one long line shrinks all the code. The card is a picture — to
change the code, remove the element and add it again.

Formulas

pptx_add_math typesets LaTeX into a transparent 300 dpi PNG and embeds it.
The formula is laid out by the plugin's own typesetter (python/math.py), so a
machine without TeX produces the same result, and the picture is placed at its
natural typographic size: a 44 pt formula is 44 pt tall on the slide.

pptx_add_slide { "file": "math.pptx", "template": "math",
                 "title": "Собственные значения", "subtitle": "линейная алгебра" }
pptx_add_math  { "file": "math.pptx", "font_size": 46,
                 "latex": "A\\mathbf{x} = \\lambda \\mathbf{x}, \\quad \\det(A - \\lambda I) = 0" }
Construct Syntax
Fractions, binomials \frac{a}{b}, \dfrac, \tfrac, \binom{n}{k}
Roots \sqrt{x}, \sqrt[3]{x}
Scripts x_i^2, \sum_{k=1}^{n}, \int_0^1, \lim_{x \to 0}
Big operators \sum \prod \coprod \int \iint \iiint \oint \bigcup \bigcap \bigoplus
Matrices matrix, pmatrix, bmatrix, Bmatrix, vmatrix, Vmatrix
Systems, derivations cases, aligned (& aligns, \\ breaks a line), array{cc}
Delimiters \left( ... \right), \left[ ... \right], \left\{ ... \right., \langle \rangle, \|x\|
Greek \alpha … \omega, \Gamma … \Omega, \varepsilon, \varphi, \vartheta
Letter styles \mathbb{R}, \mathcal{L}, \mathbf{v}, \boldsymbol{\alpha}, \mathrm{d}, \operatorname{rank}
Accents \vec{a}, \hat{x}, \bar{x}, \tilde{x}, \dot{x}, \ddot{x}, \overline{AB}
Symbols \partial \nabla \infty \pm \cdot \times \le \ge \ne \approx \equiv \in \notin \subset \subseteq \to \Rightarrow \Leftrightarrow \forall \exists
Words \text{если } x > 0

The math template leaves the lower part of the slide free; pptx_add_math
places the formula there, centred, and shrinks it only if it would not fit.
font_size 40–56 pt suits a key result, 28–32 pt a secondary line. A
multi-line derivation stays in one call:

{ "latex": "\\begin{aligned} (a+b)^2 &= a^2 + 2ab + b^2 \\\\ &= a^2 + b^2 + 2ab \\end{aligned}" }

An unsupported command fails with its position instead of producing a wrong
slide: unsupported command \fraq at position 1. Delimiters a model tends to
add ($...$, \[...\], \begin{equation}) are stripped automatically.

Examples

pptx_gallery builds reference decks from code, so they always match the
current templates:

style Contents
features A tour: all ten templates, three alignments, list and solid text, both split slides, four chart kinds, two code cards, four formula slides, palettes and settings.
showcase A polished ten-slide business deck: title, context, charts, photo slides, a metrics code card, closing.
pptx_gallery { "file": "examples/features.pptx", "style": "features", "palette": "sand" }
pptx_gallery { "file": "examples/showcase.pptx", "style": "showcase", "palette": "mint" }

Both decks are ordinary editable decks: inspect them, reuse their geometry, or
continue from them.

Deck state

A .pptx cannot be edited incrementally without a model, so the plugin keeps
the deck document in <name>.pptx.json beside the presentation and rebuilds the
package from it on every change. The sidecar is the editable source; the .pptx
is always a valid output. Deleting the sidecar does not break the presentation,
but makes it not editable by the plugin.

Configuration

Optional config fields on the pptx-builder Loader row:

Field Default Purpose
font Calibri Default text font.
accent from the palette Accent colour overriding the palette.
maxImageBytes 20971520 Size limit for a downloaded image (20 MB).
pythonPath auto-detected Python interpreter with Pillow for charts and code cards.

Requirements

  • Charts and code cards are rendered by Python with Pillow. Harness ships such
    a runtime, and the plugin finds it automatically; on another setup point
    pythonPath at an interpreter where import PIL works.
  • Images must be direct PNG, JPEG, GIF or BMP links. WebP and SVG are rejected
    with an actionable message, because PowerPoint cannot render them.

Limitations

  • Charts cover bar, stacked bar, line, area, pie and donut. No maps, heatmaps or
    3D charts.
  • Formulas are high-resolution pictures, not editable PowerPoint equations: to
    change one, remove the element and add it again. The typesetter covers the
    subset above, not the whole LaTeX language — no equation numbering, \tikz,
    chemistry packages or custom macros.
  • Photo templates fit the whole image (contain); there is no cropping.
  • Animations, speaker notes, tables and native PowerPoint charts are not
    created.
  • An image is downloaded when the tool runs; after that the deck is
    self-contained.

License

MIT — see LICENSE.