### Brython Integration for Client-Side Python Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/README.md Illustrates how to integrate Brython for running Python code directly in the browser. This example creates a simple interactive application with a button that triggers client-side Python execution. ```python from html_codegen import html, head, body, title, div, button, p, h1, pyscript with html(use_brython=True) as doc: with head(): title("Brython приложение") with body(): h1().text("Интерактивное приложение") with div(attrs={"id": "app"}): p().text("Нажмите кнопку") button(attrs={"id": "btn"}).text("Кликни меня") p(attrs={"id": "result"}) pyscript("web.scripts.py.app") # Python код выполнится в браузере doc.save("brython_app.html") ``` -------------------------------- ### Install html_codegen Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/README.md Installs the html_codegen library using pip from a Git repository. This is the primary method for adding the library to your Python environment. ```bash pip install git+https://gitlab.com/html_codegen/html_codegen.git ``` -------------------------------- ### Define and Use Custom HTML Tags Source: https://context7.com/html_codegen/html_codegen/llms.txt Illustrates how to create custom HTML tags by inheriting from Tag or SingleTag. It shows examples of custom paired tags, self-closing tags, and tags that only accept text content, along with their usage in document generation. ```python from html_codegen import html, body, p from html_codegen.tags.base_ import Tag, SingleTag, OnlyTextTagMixin # Custom paired tag class custom_card(Tag): """A custom card component.""" pass # Custom self-closing tag class custom_icon(SingleTag): """A custom icon element.""" pass # Custom tag that only accepts text content class custom_label(OnlyTextTagMixin, Tag): """A label that can only contain text.""" pass # Using custom tags with html() as doc: with body(): with custom_card(attrs={"class": "info-card", "data-type": "info"}): custom_icon(attrs={"name": "info", "size": "24"}) custom_label().text("Important Notice") p().text("This is a custom card component.") doc.save("custom.html") ``` -------------------------------- ### Structure Document Body with html_codegen Source: https://context7.com/html_codegen/html_codegen/llms.txt Demonstrates building the document's `
` content using the `body` tag. This example includes common semantic elements like `header`, `nav`, `main`, and `footer`, along with nested lists and links. The `body` tag also enforces a single instance and automatically handles Brython initialization if enabled. ```python from html_codegen import html, head, body, title, header, main, footer, h1, p, nav, ul, li, a with html() as doc: with head(): title("Semantic Page") with body(): # Header section with header(): h1().text("Site Title") with nav(): with ul(): li().a(attrs={"href": "/"}).text("Home") li().a(attrs={"href": "/about"}).text("About") # Main content with main(): h1().text("Welcome") p().text("Main content goes here...") # Footer with footer(): p().text("Copyright 2024") doc.save("semantic.html") ``` -------------------------------- ### Handle HTML CodeGen Exceptions Source: https://context7.com/html_codegen/html_codegen/llms.txt Provides examples of common exceptions raised by the HTML CodeGen library, such as SingleTagNestingError, DuplicateTagError, and BrythonNotEnabledError. It demonstrates how to use try-except blocks to catch and handle these errors gracefully. ```python from html_codegen import html, head, body, img, pyscript from html_codegen.exceptions import ( SingleTagNestingError, DuplicateTagError, BrythonNotEnabledError, NodeAlreadyHasParentError ) # SingleTagNestingError - void elements cannot have children try: with html() as doc: with body(): with img(attrs={"src": "photo.jpg"}): # img is a SingleTag pass # This will raise SingleTagNestingError except SingleTagNestingError as e: print(f"Error: {e}") # Single tag "img" cannot have nested tags # DuplicateTagError - only one head/body per document try: with html() as doc: with head(): pass with head(): # Second head tag pass # Raises DuplicateTagError except DuplicateTagError as e: print(f"Error: {e}") # Tag "head" can only appear once inside an "html" tag # BrythonNotEnabledError - pyscript requires Brython try: with html() as doc: # Missing use_brython=True with body(): pyscript("module.name") # Raises BrythonNotEnabledError except BrythonNotEnabledError as e: print(f"Error: {e}") # Correct usage with Brython enabled with html(use_brython=True) as doc: with body(): pyscript("web.scripts.py.app") # Works correctly doc.save("app.html") ``` -------------------------------- ### Generate Self-Closing HTML Elements with SingleTag Class Source: https://context7.com/html_codegen/html_codegen/llms.txt Illustrates the use of the 'SingleTag' class for creating self-closing HTML elements like meta, link, img, br, hr, and input. These elements do not support child nodes. The example shows how to add attributes to these tags. ```python from html_codegen import html, head, body, meta, link, img, br, hr, input_ with html() as doc: with head(): # Meta tags are self-closing meta(attrs={"charset": "UTF-8"}) meta(attrs={"name": "description", "content": "Page description"}) link("styles.css", rel="stylesheet") with body(): # Image tag img(attrs={ "src": "photo.jpg", "alt": "A photograph", "width": "300", "height": "200" }) # Line break br() # Horizontal rule hr() # Form input (note underscore suffix to avoid Python keyword conflict) input_(attrs={"type": "text", "name": "username", "placeholder": "Enter name"}) doc.save("void-elements.html") ``` -------------------------------- ### Generate Basic HTML Document with Renderer Source: https://context7.com/html_codegen/html_codegen/llms.txt Demonstrates how to create a simple HTML document using the html() context manager and render it to a string with custom indentation using the Renderer class. It also shows how to save the document to a file. ```python from html_codegen import html, Renderer # Create a document with html() as doc: with doc.head(): doc.title("Render Example") with doc.body(): with doc.div(attrs={"class": "content"}): doc.p().text("Hello World") # Using Renderer directly for custom rendering renderer = Renderer(doc, html_indent=4) # Custom 4-space indent # Get complete HTML output full_html = renderer.render() print(full_html) # Or use the built-in save method (uses default 2-space indent) doc.save("output.html") ``` -------------------------------- ### Basic HTML Generation using Context Managers Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/README.md Demonstrates basic HTML document generation using context managers (`with` statements) for hierarchical structures. It creates a simple HTML page with a title, heading, and a paragraph within a div. ```python from html_codegen import html, head, body, title, div, p, h1 # Context manager style with html() as doc: with head(): title("My Page") with body(): h1().text("Hello, World!") with div(attrs={"class": "container"}): p().text("This is html_codegen example.") doc.save("index.html") ``` -------------------------------- ### Generate Basic HTML Document with html_codegen Source: https://context7.com/html_codegen/html_codegen/llms.txt Demonstrates creating a basic HTML document using the `html` root tag and context managers. It shows how to add head, body, and nested elements, and save the output to a file or retrieve it as a string. This is the primary method for document generation. ```python from html_codegen import html, head, body, title, div, p, h1 # Create a basic HTML document using context manager with html() as doc: with head(): title("My Page") with body(): h1().text("Hello, World!") with div(attrs={"class": "container"}): p().text("This is html_codegen example.") # Save the document to a file doc.save("index.html") # Or get the HTML string html_string = doc.get_html() # Output: # # # #This is html_codegen example.
#tag in HTML, used for short inline quotations. It inherits from the base Tag class. ```APIDOC ## q Tag ### Description This class represents atag in HTML. It inherits from the _Tag class. ### Method POST ### Endpoint /html_codegen/tags/text/q ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **attrs** (dict | None) - Optional - Attributes for the tag. ### Request Example ```json { "attrs": { "cite": "http://example.com/source" } } ``` ### Response #### Success Response (200) - **tag_name** (string) - The name of the HTML tag ('q'). - **attributes** (dict) - The attributes applied to the tag. #### Response Example ```json { "tag_name": "q", "attributes": { "cite": "http://example.com/source" } } ``` ``` -------------------------------- ### Create HTML Aside Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'aside' tag. Inherits from the base Tag class. Accepts optional attributes. ```python class aside(Tag): """Represents an HTML aside tag.""" pass ``` -------------------------------- ### Create HTML Underline Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML u tag for underlined text. This class inherits from the base Tag class. ```python class u(Tag): """Represents a u tag in HTML.""" pass ``` -------------------------------- ### Generate HTML Quotation Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'q' tag for short, inline quotations. This class inherits from the base Tag class. ```python class html_codegen.tags.q(attrs: [dict](https://docs.python.org/3/library/stdtypes.html#dict) | [None](https://docs.python.org/3/library/constants.html#None) = None) Bases: [`Tag`](#html_codegen.tags.base_.Tag) This class represents a q tag in HTML. It inherits from the _Tag class. ``` -------------------------------- ### Create HTML Time Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'time' tag. Inherits from the base Tag class. Accepts optional attributes. ```python class time(Tag): """Represents an HTML time tag.""" pass ``` -------------------------------- ### Create Title HTML Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML title tag, which must contain text content. It inherits from OnlyTextTagMixin and Tag. ```python class title(OnlyTextTagMixin, Tag): """#### __init__(text_content: [str](https://docs.python.org/3/library/stdtypes.html#str),) -> [None](https://docs.python.org/3/library/constants.html#None)""" pass ``` -------------------------------- ### Create HTML Bold Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML b tag for bold text. This class inherits from the base Tag class. ```python class b(Tag): """Represents a b tag in HTML.""" pass ``` -------------------------------- ### Create HTML Strong Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML strong tag for important text. This class inherits from the base Tag class. ```python class strong(Tag): """Represents a strong tag in HTML.""" pass ``` -------------------------------- ### Create Base HTML Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents a base HTML tag. This class inherits from the SingleTag class. ```python class base(SingleTag): pass ``` -------------------------------- ### Create HTML Dialog Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'dialog' tag. Inherits from the base Tag class. Accepts optional attributes. ```python class dialog(Tag): """Represents an HTML dialog tag.""" pass ``` -------------------------------- ### HTML q Tag Generation (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the HTML 'q' tag, used for short inline quotations. This class inherits from the base Tag class in html_codegen. ```python class q(Tag): """Represents a q tag in HTML.""" pass ``` -------------------------------- ### Create Meta HTML Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML meta tag. This class inherits from the SingleTag class. ```python class meta(SingleTag): pass ``` -------------------------------- ### Create HTML Progress Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML progress tag. This class inherits from the base Tag class and is used for generating progress bar elements. ```python class progress(Tag): """Represents a progress tag in HTML.""" pass ``` -------------------------------- ### Create HTML H1 Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'h1' tag. Inherits from the base Tag class. Accepts optional attributes. ```python class h1(Tag): """Represents an HTML h1 tag.""" pass ``` -------------------------------- ### Create HTML Emphasis Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML em tag for emphasized text. This class inherits from the base Tag class. ```python class em(Tag): """Represents an em tag in HTML.""" pass ``` -------------------------------- ### Create HTML H6 Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML h6 tag for the smallest heading. This class inherits from the base Tag class. ```python class h6(Tag): """Represents a h6 tag in HTML.""" pass ``` -------------------------------- ### Create Map HTML Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML map tag. This class inherits from the base Tag class and can be initialized with attributes. ```python class map_(Tag): """This class represents a map tag in HTML. It inherits from the _Tag class.""" pass ``` -------------------------------- ### Generate HTML Preformatted Text Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'pre' tag for preformatted text. This class inherits from the base Tag class and preserves whitespace and line breaks. ```python class html_codegen.tags.pre(attrs: [dict](https://docs.python.org/3/library/stdtypes.html#dict) | [None](https://docs.python.org/3/library/constants.html#None) = None) Bases: [`Tag`](#html_codegen.tags.base_.Tag) This class represents a pre tag in HTML. It inherits from the _Tag class. ``` -------------------------------- ### HTML sup Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the tag in HTML, used for superscript text. It inherits from the base Tag class. ```APIDOC ## sup Tag ### Description This class represents a tag in HTML. It inherits from the _Tag class. ### Method POST ### Endpoint /html_codegen/tags/text/sup ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **attrs** (dict | None) - Optional - Attributes for the tag. ### Request Example ```json { "attrs": {} } ``` ### Response #### Success Response (200) - **tag_name** (string) - The name of the HTML tag ('sup'). - **attributes** (dict) - The attributes applied to the tag. #### Response Example ```json { "tag_name": "sup", "attributes": {} } ``` ``` -------------------------------- ### Create HTML Meter Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML meter tag. Inheriting from the base Tag class, this facilitates the creation of gauge-like elements. ```python class meter(Tag): """Represents a meter tag in HTML.""" pass ``` -------------------------------- ### HTML Summary Semantic Tag Generation Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the summary semantic tag in HTML5. It inherits from the Tag class. This class is used to generate theelement, which provides a visible heading for a element. ```python class html_codegen.tags.semantic_.summary(attrs: [dict](https://docs.python.org/3/library/stdtypes.html#dict) | [None](https://docs.python.org/3/library/constants.html#None) = None) Bases: [`Tag`](#html_codegen.tags.base_.Tag) ``` -------------------------------- ### Create HTML H1 Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML h1 tag for the main heading. This class inherits from the base Tag class. ```python class h1(Tag): """Represents a h1 tag in HTML.""" pass ``` -------------------------------- ### Generate HTML Table with Python Source: https://context7.com/html_codegen/html_codegen/llms.txt This snippet shows how to generate an HTML table using the html_codegen library in Python. It includes support for table sections like thead, tbody, and tfoot, as well as rows (tr), headers (th), and data cells (td). The generated table is saved to 'table.html'. ```python from html_codegen import ( html, head, body, title, table, caption, thead, tbody, tfoot, tr, th, td ) with html() as doc: with head(): title("Sales Report") with body(): with table(attrs={"class": "data-table", "border": "1"}): caption().text("Quarterly Sales Report") # Table header with thead(): with tr(): th().text("Month") th().text("Sales") th().text("Revenue") th().text("Growth") # Table body with tbody(): with tr(): td().text("January") td().text("1,200") td().text("$24,000") td().text("+5%") with tr(): td().text("February") td().text("1,450") td().text("$29,000") td().text("+8%") with tr(): td().text("March") td().text("1,380") td().text("$27,600") td().text("+3%") # Table footer with tfoot(): with tr(): th().text("Total") th().text("4,030") th().text("$80,600") th().text("+5.3% avg") doc.save("table.html") ``` -------------------------------- ### HTML samp Tag Generation (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the HTML 'samp' tag, used for sample output from a computer program. This class inherits from the base Tag class in html_codegen. ```python class samp(Tag): """Represents a samp tag in HTML.""" pass ``` -------------------------------- ### Add Child Nodes to HTMLNode (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Illustrates the process of adding child nodes to an existing HTMLNode. The `add_node` method is used for this purpose, ensuring that the new node is correctly appended to the parent. A validation step (`add_node_validation`) can be implemented before adding the node. ```Python from html_codegen.core import HTMLNode parent_node = HTMLNode() child_node = HTMLNode() # Add the child_node to the parent_node parent_node.add_node(child_node) # The parent_node now has child_node as one of its children. ``` -------------------------------- ### Generate HTML Citation Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'cite' tag for the title of a work (e.g., book, movie). This class inherits from the base Tag class. ```python class html_codegen.tags.cite(attrs: [dict](https://docs.python.org/3/library/stdtypes.html#dict) | [None](https://docs.python.org/3/library/constants.html#None) = None) Bases: [`Tag`](#html_codegen.tags.base_.Tag) This class represents a cite tag in HTML. It inherits from the _Tag class. ``` -------------------------------- ### Generate HTML Address Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'address' tag for contact information. This class inherits from the base Tag class. ```python class html_codegen.tags.address(attrs: [dict](https://docs.python.org/3/library/stdtypes.html#dict) | [None](https://docs.python.org/3/library/constants.html#None) = None) Bases: [`Tag`](#html_codegen.tags.base_.Tag) This class represents an address tag in HTML. It inherits from the _Tag class. ``` -------------------------------- ### Create HTML Figure Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'figure' tag. Inherits from the base Tag class. Accepts optional attributes. ```python class figure(Tag): """Represents an HTML figure tag.""" pass ``` -------------------------------- ### Create Link HTML Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML link tag, requiring href and rel attributes. It inherits from SingleTag and can accept additional keyword arguments. ```python class link(SingleTag): """#### __init__(href: [str](https://docs.python.org/3/library/stdtypes.html#str), , rel: [str](https://docs.python.org/3/library/stdtypes.html#str), **kwargs) -> [None](https://docs.python.org/3/library/constants.html#None) Initialize an HTML class instance. * **Parameters:** * **tag_name** ([*str*](https://docs.python.org/3/library/stdtypes.html#str)) – Tag name of the element * **attrs** ([*dict*](https://docs.python.org/3/library/stdtypes.html#dict) *,* *optional*) – Dictionary of element attributes""" pass ``` -------------------------------- ### HTML kbd Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the tag in HTML, used for keyboard input. It inherits from the base Tag class. ```APIDOC ## kbd Tag ### Description This class represents a tag in HTML. It inherits from the _Tag class. ### Method POST ### Endpoint /html_codegen/tags/text/kbd ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **attrs** (dict | None) - Optional - Attributes for the tag. ### Request Example ```json { "attrs": {} } ``` ### Response #### Success Response (200) - **tag_name** (string) - The name of the HTML tag ('kbd'). - **attributes** (dict) - The attributes applied to the tag. #### Response Example ```json { "tag_name": "kbd", "attributes": {} } ``` ``` -------------------------------- ### HTML sup Tag Generation (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the HTML 'sup' tag, used for superscript text. This class inherits from the base Tag class in html_codegen. ```python class sup(Tag): """Represents a sup tag in HTML.""" pass ``` -------------------------------- ### Generate HTML Keyboard Input Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'kbd' tag, typically used for keyboard input. This class inherits from the base Tag class. ```python class html_codegen.tags.kbd(attrs: [dict](https://docs.python.org/3/library/stdtypes.html#dict) | [None](https://docs.python.org/3/library/constants.html#None) = None) Bases: [`Tag`](#html_codegen.tags.base_.Tag) This class represents a kbd tag in HTML. It inherits from the _Tag class. ``` -------------------------------- ### Create HTML H5 Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML h5 tag for a smaller subheading. This class inherits from the base Tag class. ```python class h5(Tag): """Represents a h5 tag in HTML.""" pass ``` -------------------------------- ### Create HTML H2 Tag (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'h2' tag. Inherits from the base Tag class. Accepts optional attributes. ```python class h2(Tag): """Represents an HTML h2 tag.""" pass ``` -------------------------------- ### HTML address Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the tag in HTML, used for contact information. It inherits from the base Tag class. ```APIDOC ## address Tag ### Description This class represents an tag in HTML. It inherits from the _Tag class. ### Method POST ### Endpoint /html_codegen/tags/text/address ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **attrs** (dict | None) - Optional - Attributes for the tag. ### Request Example ```json { "attrs": {} } ``` ### Response #### Success Response (200) - **tag_name** (string) - The name of the HTML tag ('address'). - **attributes** (dict) - The attributes applied to the tag. #### Response Example ```json { "tag_name": "address", "attributes": {} } ``` ``` -------------------------------- ### Generate HTML Line Break Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML 'br' tag for a single line break. This class inherits from the base Tag class. ```python class html_codegen.tags.br(attrs: [dict](https://docs.python.org/3/library/stdtypes.html#dict) | [None](https://docs.python.org/3/library/constants.html#None) = None) Bases: [`Tag`](#html_codegen.tags.base_.Tag) This class represents a br tag in HTML. It inherits from the _Tag class. ``` -------------------------------- ### HTML cite Tag Generation (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the HTML 'cite' tag, used for the title of a work (e.g., book, movie). This class inherits from the base Tag class in html_codegen. ```python class cite(Tag): """Represents a cite tag in HTML.""" pass ``` -------------------------------- ### Create Anchor HTML Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents an HTML anchor (a) tag, used for creating hyperlinks. This class inherits from the base Tag class and can be initialized with attributes. ```python class a(Tag): """This class represents an a tag in HTML. It inherits from the _Tag class.""" pass ``` -------------------------------- ### HTML pre Tag Generation (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the HTML 'pre' tag, used for preformatted text, preserving whitespace. This class inherits from the base Tag class in html_codegen. ```python class pre(Tag): """Represents a pre tag in HTML.""" pass ``` -------------------------------- ### HTML pre Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents thetag in HTML, used for preformatted text, typically code blocks. It inherits from the base Tag class. ```APIDOC ## pre Tag ### Description This class represents atag in HTML. It inherits from the _Tag class. ### Method POST ### Endpoint /html_codegen/tags/text/pre ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **attrs** (dict | None) - Optional - Attributes for the tag. ### Request Example ```json { "attrs": { "class": "code-block" } } ``` ### Response #### Success Response (200) - **tag_name** (string) - The name of the HTML tag ('pre'). - **attributes** (dict) - The attributes applied to the tag. #### Response Example ```json { "tag_name": "pre", "attributes": { "class": "code-block" } } ``` ``` -------------------------------- ### HTML kbd Tag Generation (Python) Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the HTML 'kbd' tag, used for keyboard input. This class inherits from the base Tag class in html_codegen. ```python class kbd(Tag): """Represents a kbd tag in HTML.""" pass ``` -------------------------------- ### HTML samp Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the tag in HTML, used for sample output from a computer program. It inherits from the base Tag class. ```APIDOC ## samp Tag ### Description This class represents a tag in HTML. It inherits from the _Tag class. ### Method POST ### Endpoint /html_codegen/tags/text/samp ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **attrs** (dict | None) - Optional - Attributes for the tag. ### Request Example ```json { "attrs": {} } ``` ### Response #### Success Response (200) - **tag_name** (string) - The name of the HTML tag ('samp'). - **attributes** (dict) - The attributes applied to the tag. #### Response Example ```json { "tag_name": "samp", "attributes": {} } ``` ``` -------------------------------- ### HTML cite Tag Source: https://gitlab.com/html_codegen/html_codegen/-/blob/main/docs/source/api.md Represents the tag in HTML, used for the title of a creative work. It inherits from the base Tag class. ```APIDOC ## cite Tag ### Description This class represents a tag in HTML. It inherits from the _Tag class. ### Method POST ### Endpoint /html_codegen/tags/text/cite ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **attrs** (dict | None) - Optional - Attributes for the tag. ### Request Example ```json { "attrs": {} } ``` ### Response #### Success Response (200) - **tag_name** (string) - The name of the HTML tag ('cite'). - **attributes** (dict) - The attributes applied to the tag. #### Response Example ```json { "tag_name": "cite", "attributes": {} } ``` ```