![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
While I love Beautiful Soup as a parser, BeautifulSoup.prettify()
adds a linebreak between every tag.
This results in unwanted white space between tags that should be inline, like <sup>
, <a>
, <span>
, etc:
<p>Introducing GitHub<sup>®</sup></p>
Introducing GitHub®
vs.
<p>
Introducing GitHub
<sup>
®
</sup>
</p>
Introducing GitHub ®
This module parses HTML/XML as a raw string to more intelligently format tags.
You have two options:
pip install prettierfier
in your command lineThis module is built with just the Python Standard Library and contains no external third-party dependencies.
prettify_xml(xml_string, indent=2, debug=False)
Args:
xml_string (str): XML text to prettify.
indent (int, optional): Set size of XML tag indents.
Test-only args:
debug (bool, optional): Show results of each regexp application.
Returns:
str: Prettified XML.
prettify_html(html_string, debug=False)
BeautifulSoup.prettify()
output. Args:
html_string (str): HTML string to parse.
Test-only args:
debug (bool, optional): Show results of each regexp application.
Returns:
str: Prettified HTML.
import prettierfier
ugly_html = """<p>
Introducing GitHub
<sup>
®
</sup>
</p>"""
pretty_html = prettierfier.prettify_html(ugly_html)
print(pretty_html)
# Output
>>> <p>Introducing GitHub<sup>®</sup></p>
FAQs
Intelligently pretty-print HTML/XML with inline tags.
We found that prettierfier demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.