md2star package
Subpackages
- md2star.preprocessing package
- Submodules
- md2star.preprocessing.alt_text module
- md2star.preprocessing.images module
- md2star.preprocessing.language module
- md2star.preprocessing.lint module
- md2star.preprocessing.math module
- md2star.preprocessing.mermaid module
- md2star.preprocessing.pipeline module
- md2star.preprocessing.regexes module
- md2star.preprocessing.tables module
- Module contents
- Submodules
Submodules
- md2star.api module
- md2star.cache module
- md2star.cli module
- md2star.doctor module
- md2star.errors module
- md2star.gui module
- md2star.gui_server module
- md2star.i18n module
- md2star.linebreak module
- md2star.logging module
- md2star.mcp module
- md2star.pipeline module
- Author
ConvertOptionsConvertOptions.inputConvertOptions.outputConvertOptions.bibConvertOptions.bibliography_nameConvertOptions.lintConvertOptions.skip_phaseConvertOptions.reference_docConvertOptions.offlineConvertOptions.no_remote_templatesConvertOptions.allow_remote_imagesConvertOptions.smart_layoutConvertOptions.templateConvertOptions.reference_slidesConvertOptions.no_visual_confirmConvertOptions.eyeball_iterationsConvertOptions.min_ptConvertOptions.refresh_catalogConvertOptions.allow_remote_imagesConvertOptions.authorConvertOptions.bibConvertOptions.bibliography_nameConvertOptions.dateConvertOptions.eyeball_iterationsConvertOptions.inputConvertOptions.langConvertOptions.lintConvertOptions.min_ptConvertOptions.no_remote_templatesConvertOptions.no_visual_confirmConvertOptions.offlineConvertOptions.outputConvertOptions.quietConvertOptions.reference_docConvertOptions.reference_slidesConvertOptions.refresh_catalogConvertOptions.skip_phaseConvertOptions.smart_layoutConvertOptions.templateConvertOptions.verbose
convert()
- md2star.postprocess module
- md2star.pptx_assemble module
- Author
AssembleResultCREDIT_NAMECREDIT_SIZESItemLATENT_KINDSPHOTO_TITLE_WORDSSMALLEST_BASE_PTTITLE_KINDSadd_code()add_credit()add_image()add_table()add_text()assemble()background_rgb()body_items()clear_slides()content_box()credit_lines()credit_pictures()declared_style()drop_empty_placeholders()eyeball_slides()fallback_bullets()image_box()image_title()is_content()is_dark_layout()is_ornament()layout_index()notes_paragraphs()parse_alt_text()parse_code()parse_image()parse_image_credit()parse_mermaid()parse_table()placeholder_kind()short_credit()slide_placeholder()template_fonts()title_box()
- md2star.pptx_audit module
- md2star.pptx_clone module
- md2star.pptx_fit module
- The missing constant: a minimum font size
- How capacity is estimated
- How candidates are scored
- Author
ALIGNMENT_TOLERANCEASPECT_OCTAVE_TOLERANCEAVG_CHAR_WIDTH_EMBALANCE_TOLERANCECAPTION_CHARSCapacityContentMetricsContentMetrics.big_statementContentMetrics.body_charsContentMetrics.bullet_countContentMetrics.bullet_lengthsContentMetrics.code_linesContentMetrics.columnsContentMetrics.image_countContentMetrics.image_pathsContentMetrics.is_sparseContentMetrics.longest_bullet_charsContentMetrics.table_colsContentMetrics.table_rowsContentMetrics.title_charsContentMetrics.word_count
EMU_PER_PTFIT_SLACKFitReportKAWASAKI_MAX_SLIDESKAWASAKI_MIN_PTLINE_SPACINGPARAGRAPH_GAP_LINESTARGET_OCCUPANCYTHIRDS_TOLERANCEalignment()aspect_match()balance()body_capacity()capacity_for_prompt()composition()deck_advice()evaluate()measure()placeholder_capacity()rank()reading_order()summarise_for_prompt()thirds()
- md2star.pptx_layout module
- Author
CATALOG_VERSIONCLASS_HINTSLayoutInfoPAGINATE_MARGINPHOTO_SHAREPlaceholderRenderLayoutFnSlideVISUAL_VARIETY_SHAREbuild_catalog()code_layout()column_regions()continuation_label()default_chat()default_render()default_render_layout()extract_layouts()is_photo_layout()largest_columns_layout()largest_picture_layout()layout_pages()paginate()parse_heading()parse_json_reply()render_deck_pages()resolve_hint()segment()select_layouts()slide_size()smart_layout_available()split_columns()split_front_matter()split_notes()split_slide()stage_region()visual_confirm()
- md2star.reverse module
- md2star.reverse_diagrams module
- md2star.templates module
- md2star.twin_cli module
Module contents
md2star: Markdown → DOCX/PPTX/PDF bridge built on Pandoc.
Module summary
Public package surface for md2star. Re-exports the preprocessor entry
points so consumers can import them either from the top-level package
or from the md2star.preprocessing submodule.
Usage
>>> from md2star import preprocess_markdown
>>> out = preprocess_markdown("# Hello\n", base_dir=".")
>>> print(out.splitlines()[0]) # '# Hello'
# Hello
- md2star.fill_empty_alt_text(content, base_dir='.', model=None)[source]
Replace
empty-alt images with an LLM-generated description.Mirrors
md2star.preprocessing.lint.lint_with_llm()’s safety net: the model call in_generate_alt()swallows every failure (engine unresolvable, backend/model unreachable, transport error) intoNone, and each such image is left untouched. The pass is never load-bearing. model is an optional per-call vision-model tag override; whenNonethe tag comes from md2star’s resolved engine descriptor.
- md2star.lint_with_llm(content, model=None)[source]
Send content to the local LLM for syntax-only fixes; return original on any failure.
The 0.5×–2× length guard is a coarse hallucination/truncation check; if the response strays outside that band, the original is kept. Resolution of which model and backend to use is delegated entirely to the suite’s brief -> engine contract (
md2star._engine.engine()); model is an optional per-call tag override passed straight through tobest_engine_ai_helper.llm.chat(). Any failure — the engine cannot be resolved (missing brief, no reachable backend/model), the request errors, or the output looks wrong — degrades to the untouched content.
- md2star.preprocess_markdown(content, base_dir='.', inject_metadata=True, lint_enabled=False, skip_phases=None, *, allow_remote_images=False, offline=False)[source]
Run the full preprocessing pipeline on a Markdown string.
- Parameters:
content (str) – Raw Markdown source.
base_dir (str) – Directory used to resolve relative image paths and to receive downloaded remote images / mermaid renders.
inject_metadata (bool) – Whether to inject
lang/date_formatbased on language detection (default: True). Equivalent to skippinglanguage.lint_enabled (bool) – Whether to run the optional Ollama LLM lint (default: False). Opt-in because it requires Ollama, adds latency, and can in rare cases rewrite content despite the safety guard.
skip_phases (Iterable[str], optional) – Phase names to skip (see
PHASES). Merged with anymd2star_skip:list found in the document’s YAML front-matter.allow_remote_images (bool, keyword-only) – Whether to download
references. Defaults toFalse(the safe-by-default policy introduced in v1.2.0): remote image markers are left in place, and the user sees a warning if any were skipped. PassTrueto opt in.offline (bool, keyword-only) – Hard-disable every network-touching phase. Takes precedence over
allow_remote_imagesandlint_enabled.
- Return type: