Skip to content

Integrate HTML stripping into doc-builder - #684

Merged
mishig25 merged 3 commits into
mainfrom
integrate-html-stripping-in-build
Nov 12, 2025
Merged

mishig25 merged 3 commits into
mainfrom
integrate-html-stripping-in-build

Conversation

@mishig25

Copy link
Copy Markdown
Contributor

Description

This PR integrates HTML stripping directly into the doc-builder build process, automatically cleaning up docstring HTML when generating documentation.

Key Changes

1. HTML Stripping in Build Process (src/doc_builder/utils.py)

  • Added HTMLStripper class and related functions to strip HTML from markdown
  • Modified write_markdown_route_file() to strip HTML when writing final SvelteKit markdown routes
  • HTML stripping now happens automatically during doc generation

2. Standalone Script (for reference/manual use)

  • src/scripts/strip_html_from_md.py - Can be used to manually process markdown files
  • README_strip_html.md - Documentation for the standalone script

How it Works

When doc-builder generates documentation:

  1. Builds intermediate .mdx files with HTML intact
  2. Converts to SvelteKit routes
  3. Strips HTML when writing final +page.md files
  4. Result: Clean markdown without HTML tags

Formatting Changes

Docstrings are automatically transformed:

  • Class/function names: #### ClassName[[anchor]]
  • Parameters: Clean format with : separator and blank lines
  • No bullets or bold formatting
  • Returns section properly formatted

Benefits

  • Automatic HTML stripping during build (no separate step needed)
  • Cleaner markdown output for all packages
  • Better readability and maintenance
  • Works seamlessly with existing build process

- Add HTML stripping functions to src/doc_builder/utils.py
- Strip HTML when writing final markdown files (in write_markdown_route_file)
- Add standalone script src/scripts/strip_html_from_md.py for manual use
- Add README_strip_html.md with documentation

HTML stripping now happens automatically during the build process when creating
SvelteKit markdown routes (+page.md files), removing docstring HTML tags and
converting them to clean markdown with proper formatting.
HTML stripping is now integrated into the build process itself
(in write_markdown_route_file), so separate workflow steps are not needed.
HTML stripping is now fully integrated into doc_builder/utils.py,
so the standalone script and its documentation are no longer needed.
@mishig25
mishig25 merged commit 4c9e9b5 into main Nov 12, 2025
@mishig25
mishig25 deleted the integrate-html-stripping-in-build branch November 12, 2025 20:43
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.

1 participant