html_to_markdown#
- scikitplot._externals._sphinx_ext._sphinx_ai_assistant.html_to_markdown(html_content, strip_tags=None)[source]#
Convert an HTML string to Markdown using the Sphinx-tuned converter.
- Parameters:
- html_contentstr
Raw HTML string to convert.
- strip_tagslist of str or None, optional
HTML tag names whose elements (including all their content) are removed before conversion. Defaults to
["script", "style"]whenNone.
- Returns:
- str
Markdown representation of the HTML content.
- Raises:
- ImportError
If
markdownifyis not installed.
- Parameters:
- Return type:
See also
_build_converter_classFactory for the converter class.
Notes
bs4is imported lazily inside this function. If it is not available the stripping step is skipped silently;markdownify’s ownstrip=option still removes the listed tags from the output.The converter itself is cached between calls (module-level singleton).
Examples
>>> html_to_markdown("<h1>Hello</h1><p>World</p>") '# Hello\n\nWorld\n\n'