Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@hedia/html

Package Overview
Dependencies
Maintainers
9
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@hedia/html

HTML

  • 1.0.3
  • unpublished
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
9
Weekly downloads
 
Created
Source

@hedia/html

Install

$ npm install @hedia/html -E

Usage

import { attr, comment, document, render } from "@hedia/html";
import { a, body, h1, head, html, img, meta, p, title } from "@hedia/html/elements";
import { content, name, style } from "@hedia/html/attributes";

render(
  document(
    html(
      lang("en"),
      comment("head --"),
      head(
        title("HTML | Hedia"),
        meta(
          name("description"),
          content("Hedia HTML Renderer."),
        ),
        meta(
          name("keywords"),
          content("hedia,html,rendering."),
        ),
      ),
      body(
        h1("HTML", isItMonday() && p("It is monday")),
        p(style("font-weight: bold"), "Hedia HTML Renderer."),
        img(
          src(
            "https://www.hedia.co/wp-content/uploads/2017/03/hedia_blue.png",
          ),
        ),
        a(href("https://hedia.co/"), "Hedia"),
      ),
    ),
  ),
);

Outputs:

<!DOCTYPE html>
<html lang="en">

<head>
    <!--head-->
    <title>HTML | Hedia</title>
    <meta name="description" content="Hedia HTML Renderer.">
    <meta name="keywords" content="hedia,html,rendering.">
</head>

<body>
    <h1>HTML</h1>
    <p style="font-weight: bold">Hedia HTML Renderer.</p>
    <img src="https://www.hedia.co/wp-content/uploads/2017/03/hedia_blue.png">
    <a href="https://hedia.co/">Hedia</a>
</body>

</html>

API

renderToBuffer

Renders the Document, Element or Text node to a Buffer with UTF-8 encoding.

import { attr, document, renderToBuffer } from "@hedia/html";
import { body, head, html, } from "@hedia/html/elements";

const buffer = renderToBuffer(
  document(
    html(
      head(),
      body(),
    ),
  ),
);

renderToReadable

Renders the Document, Element or Text node to a Readable 64kb at a time.

import { document, renderToReadable } from "@hedia/html";
import { body, head, html, } from "@hedia/html/elements";

const readable = renderToReadable(
  document(
    html(
      head(),
      body(),
    ),
  ),
);

process.stdout.pipe(readable);

Build

$ npm run build

Test

$ npm test

FAQs

Package last updated on 14 Feb 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc