Socket
Socket
Sign inDemoInstall

@gelight/sml-page-builder

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @gelight/sml-page-builder

Simple Page Builder based on SML


Version published
Maintainers
1
Created

Readme

Source

SML Page Builder

The simple page generator based on SML

Using

Example page definition - ./layouts/page-layout.sml

Div
    class example-page-layout
    Slot default
End

Example page definition - ./pages/index.sml

Slot
    From ../layouts/page-layout.sml
    Name default
    Section
        class container markdown
        h1
            id title
            Text Hello World
        End
        IncludeGithubMarkdownFile https://raw.githubusercontent.com/ReliableTXT/ReliableTXT/main /ReliableTXT_Specification.md
    End
End

Use the SmlPageBuilder to generate html files based on your defined SML files. This example use three other classes CustomTagText and CustomTagIncludeGithubMarkdownFile to manipulate any attributes or elements with related tag names.

import * as path from "path";
import {
    CustomTagIncludeGithubMarkdownFile,
    CustomTagSlot,
    CustomTagText,
    SmlPageBuilder
} from "@gelight/sml-page-builder";

const PATH = path.resolve(__dirname, "pages");
const OUTPUT_PATH = path.resolve(__dirname, "sites");
const ASSETS_PATH = path.resolve(__dirname, "assets");

new SmlPageBuilder()
    .setAssetsPath(ASSETS_PATH)
    .setPagesPath(PATH)
    .setOutputPath(OUTPUT_PATH)
    .registerCustomTag("Text", CustomTagText)
    .registerCustomTag("Slot", CustomTagSlot)
    .registerCustomTag("IncludeGithubMarkdownFile", CustomTagIncludeGithubMarkdownFile)
    .build();

Output:

<div class="example-page-layout">

    <h1 id="title">
        Hello World
    </h1>
    
    ... included Github markdown converted to HTML ...

</div>

Keywords

FAQs

Last updated on 30 Apr 2021

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc