Giter VIP home page Giter VIP logo

style's Introduction

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

style's People

Contributors

pirmd avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.