Socket
Book a DemoInstallSign in
Socket

github.com/pirmd/style

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/pirmd/style

v0.4.0
Source
Go
Version published
Created
Source

PACKAGE STYLE

GoDoc  Go Report Card 

style provides functions that decorate text (like formatting, changing case or colors) using several idioms (plain text, (non-)colored term, mandoc, markdown). Proposed styles are supposed to be easily extendable.

EXAMPLE

package main

import (
        "fmt"

        "github.com/pirmd/style"
       )

func Main() {
    st := style.NewColorterm()
    //Can also be st := style.NewMarkdown()

    H := style.Chain(st.Header(1), st.Blue)
    H2 := style.Chain(st.Header(2), st.Red)

    s := H("Introduction")
    s += st.Paragraph("This small piece of text aims at demonstrating and testing package '" + st.Underline("style") + "'.")
    s += st.Paragraph("It is written by a " + st.Bold("non-native") + " English speaker, so pardon any faults.")

    s += H2("Demonstrating lists")
    s += st.Paragraph("It knows how to format " + st.Italic("lists") + ": ")
    s += st.BulletedList()(
            "This very long and detailed sentence is here to demonstrate that list can be formatted and wrapped. It should hopefully be so long that it will not fulfill the maximum number of authorized chars per line is reached.",
            "It also can support sub-lists:\n"+st.BulletedList()(
                "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.",
                "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.",
            ),
        )

    s += H2("Demonstrating tables")
    s += st.Paragraph("Package 'style' supports drawing tables for most basic cases.")
    s += st.Table(
            []string{"Column1", "Column2", "Column3"},
            []string{"Basic column", "This one is here\nto demonstrate\nthat colums with several lines work too", "Last but not least shows " + st.Bold("formating") + " within the table"},
            []string{"", "This second row is here to test multi-lines rows format", "Also possibly a second chance to verify that multi-lines is working"},
        )

    fmt.Print(s)
}

A slightly more complete example can be found in testing file or in clapp package's help or manpage files generation.

INSTALLATION

Everything should work fine using go standard commands (build, get, install...).

USAGE

Running go doc github.com/pirmd/style should give you helpful guidelines on available features.

CONTRIBUTION

If you feel like to contribute, just follow github guidelines on forking then send a pull request

FAQs

Package last updated on 15 May 2020

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

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.