AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He
fix(source-to-md): keep never-rendered <template> markup out of HTML sources
hugohe3b7a2d9fcf6ba
diff --git a/skills/ppt-master/scripts/source_to_md/doc_to_md.py b/skills/ppt-master/scripts/source_to_md/doc_to_md.pyindex 03b6006c..045380cf 100644--- a/skills/ppt-master/scripts/source_to_md/doc_to_md.py+++ b/skills/ppt-master/scripts/source_to_md/doc_to_md.py@@ -1195,9 +1195,10 @@ def _convert_html(input_file: Path, out_file: Path) -> str:file=sys.stderr,)- # Strip non-content elements (head/style/script) so metadata doesn't leak into MD+ # Strip non-content elements (head/style/script/template) so metadata and+ # never-rendered markup don't leak into MDsoup = BeautifulSoup(raw_html, "html.parser")- for tag in soup(["head", "style", "script", "noscript"]):+ for tag in soup(["head", "style", "script", "noscript", "template"]):tag.decompose()html = str(soup)html = _process_html_images(html, input_file.parent, media_dir, rel_media_dir)diff --git a/skills/ppt-master/scripts/source_to_md/web_to_md.py b/skills/ppt-master/scripts/source_to_md/web_to_md.pyindex a0e173dd..48464cd4 100644--- a/skills/ppt-master/scripts/source_to_md/web_to_md.py+++ b/skills/ppt-master/scripts/source_to_md/web_to_md.py@@ -887,7 +887,7 @@ def find_main_content(soup: BeautifulSoup) -> Tag | None:for element in elements:if not any(element is existing for existing in candidates):candidates.append(element)- for tag in soup(["script", "style", "nav", "noscript", "iframe"]):+ for tag in soup(["script", "style", "nav", "noscript", "template", "iframe"]):tag.decompose()for tag in soup(["header", "footer", "aside"]):if not any(tag is body or body in tag.parents for body in candidates):diff --git a/skills/ppt-master/scripts/tests/test_source_to_md_content_loss_docx.py b/skills/ppt-master/scripts/tests/test_source_to_md_content_loss_docx.pyindex fb13919d..a05dc3bc 100644--- a/skills/ppt-master/scripts/tests/test_source_to_md_content_loss_docx.py+++ b/skills/ppt-master/scripts/tests/test_source_to_md_content_loss_docx.py@@ -42,6 +42,22 @@ class HtmlCharsetTests(unittest.TestCase):self.assertIn("中文收入", markdown)self.assertNotIn("\ufffd", markdown)+ def test_template_markup_never_reaches_markdown(self) -> None:+ sys.path.insert(0, str(Path(doc_to_md.__file__).parent))+ import web_to_md++ html = ('<html><body><article><p>Visible body</p>'+ '<template><p>TEMPLATE_ONLY</p></template></article></body></html>')+ with tempfile.TemporaryDirectory() as tmp:+ source = Path(tmp) / "page.html"+ source.write_text(html, encoding="utf-8")+ with redirect_stdout(io.StringIO()):+ markdown = doc_to_md.convert_to_markdown(str(source))+ self.assertIn("Visible body", markdown)+ self.assertNotIn("TEMPLATE_ONLY", markdown)+ main = web_to_md.find_main_content(web_to_md.BeautifulSoup(html, "html.parser"))+ self.assertIsNotNone(main)+ self.assertNotIn("TEMPLATE_ONLY", main.get_text())class NotebookContentLossTests(unittest.TestCase):def test_attachments_do_not_overwrite_named_outputs_or_each_other(self) -> None: