Skip to content

feat: section-type detection, type-specific layouts, and per-section style customisation (v0.7.0)#4

Draft
fasilwdr with Copilot wants to merge 2 commits into
mainfrom
copilot/create-implementation-plan
Draft

feat: section-type detection, type-specific layouts, and per-section style customisation (v0.7.0)#4
fasilwdr with Copilot wants to merge 2 commits into
mainfrom
copilot/create-implementation-plan

Conversation

Copilot AI commented May 5, 2026

Copy link
Copy Markdown

The converter applied a single generic layout to all content regardless of structure. This replaces it with a pipeline that auto-detects each ----separated block's type from its ## heading and renders an appropriate layout.

Core pipeline (utils.py)

The old monolithic process_headings/apply_element_styling approach and the 130-entry DEFAULT_STYLE_CONFIG are removed. The new pipeline:

  1. handle_images — resolves paths, copies local files (also fixes off-by-one bug stripping static/description/ prefix: 18 → 19 chars)
  2. parse_document — splits on ---, then on ## headings, tagging each block with a section type; blocks with no ## inherit the previous type
  3. group_sections — merges consecutive same-type blocks (enables multi-block FAQ / Usage)
  4. render_section_group — dispatches to a type-specific renderer

Nine section types with dedicated renderers

Type Layout
overview intro paragraph + h3 card grid
features h3 card grid
installation / configuration centred steps + fenced code blocks
screenshots responsive gallery (img + blockquote → figcaption)
usage h3 workflow card grid
known_issues alert box
faq Q&A list — one item per --- block
changelog version-entry cards (h3 = version header)
generic centred content block

Detection keywords live in SECTION_TYPE_KEYWORDS; the default CSS classes for every rendered element live in DEFAULT_SECTION_STYLES — both exported from the package.

Per-section style customisation

Any key in DEFAULT_SECTION_STYLES is overridable at runtime:

# CLI
md2indexhtml README.md --style-config my_style.json
{
  "overview": { "section_class": "o_section_overview py-5 bg-primary text-white" },
  "faq":      { "question_class": "faq-question h5 font-weight-bold text-primary" }
}
# Python API
convert_md_to_html("README.md", style_config={
    "screenshots": {"grid_class": "row row-cols-1 row-cols-md-3"},
})

HTML document wrapper

Self-contained inline CSS grid + typography reset replaces the prior approach (which referenced Bootstrap classes with no Bootstrap CDN), making output fully standalone and Odoo Apps Store sanitizer-safe.

README

Completely rewritten: section-type detection table, style-key reference, multi-block continuation explanation, CLI/API examples.

Copilot AI linked an issue May 5, 2026 that may be closed by this pull request
Copilot AI changed the title [WIP] Create implementation plan for package features feat: section-type detection, type-specific layouts, and per-section style customisation (v0.7.0) May 5, 2026
Copilot AI requested a review from fasilwdr May 5, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

New Plan for the package

2 participants