Mage Build Tool

repository·master·Indexed 26 days ago

https://github.com/magefile/mage

A type-safe, cross-platform build tool for Go that allows users to write build targets as plain Go functions. It provides a Makefile alternative with support for dependency trees via the mg helper library, static binary compilation for different OS/architectures, and a CLI for target execution and environment initialization.

Tokens
17.5K
Snippets
81
Records
155
Agent score
80%

What's inside Mage

  1. Overview of Hugo Learn Theme features

    master

    The Hugo Learn theme is designed specifically for documentation and supports a page tree structure. Key features include:

    • Automatic Search: Built-in search capabilities.
    • Multilingual mode: Support for multiple languages.
    • Navigation: Unlimited menu levels and automatic next/prev buttons for menu entries.
    • Content Enhancements: Image resizing/shadows, attachment files, and Mermaid diagram support (flowchart, sequence, gantt).
    • Shortcodes: Includes buttons, notice boxes (Tip/Note/Info/Warning), expand/collapse sections, and child page lists.
  2. Key features of the Learn theme

    master

    The Learn theme is designed specifically for documentation and includes the following features:

    • Automatic Search: Built-in search functionality.
    • Multi-language Support: Capability to handle multiple languages.
    • Infinite Menu Nesting: Support for deeply nested menu structures.
    • Automatic Navigation: Automatically generated 'Next' and 'Previous' buttons for navigating menu items.
    • Mermaid Diagrams: Support for flowcharts, sequence diagrams, and gantt charts via Mermaid.
    • Shortcodes: Includes shortcodes for buttons, attachments, listing child pages, expand/collapse elements, and notice messages (Tip, Note, Info, Attention).
    • Configurable Styling: Customizable styles and color variants.
  3. Declare dependencies using mg.Deps

    master

    Mage uses the github.com/magefile/mage/mg helper library to support a makefile-style tree of dependencies. To declare dependencies, pass the dependent functions to mg.Deps. The Deps function will not return until all declared dependencies (and their own dependencies) have completed. Dependencies are guaranteed to run exactly once per execution.

    Requirements for dependent functions:

    • May have an optional first argument of context.Context.
    • Must have either no return value or only an error return.
    • All other arguments must be of type string, int, bool, or time.Duration.
    • Unlike targets, dependent functions do not need to be exported.
  4. Insert and customize images

    master

    Images use a syntax similar to links but prefixed with an exclamation point (!).

    Basic Syntax

    • Standard: ![Alt text](URL "Optional Title")
    • Reference style: Use ![Alt text][id] and define the reference at the bottom of the document using [id]: URL "Title".

    Resizing Images

    You can resize images by adding width and/or height as HTTP parameters to the image URL. Supported values are CSS values (e.g., 20%, 50px, 300px).

    Adding CSS Classes

    Add a classes HTTP parameter to the image URL to apply CSS classes. Available built-in classes include shadow and border. Multiple classes can be added using a comma-separated list.

    ![Minion](http://octodex.github.com/images/minion.png?width=20%)
    ![Minion](http://octodex.github.com/images/minion.png?height=50px&width=300px)
    ![stormtroopocat](http://octodex.github.com/images/stormtroopocat.jpg?classes=border,shadow)
  5. Install Mage using GOPATH (Go < 1.17)

    master

    If you are using an older version of Go with a GOPATH setup, download the package using go get and run the provided bootstrap.go script.

    go get -u -d github.com/magefile/mage
    cd $GOPATH/src/github.com/magefile/mage
    go run bootstrap.go
  6. Use Chapter and Default page types

    master

    The hugo-theme-learn theme provides two page types that change how content is displayed:

    1. Chapter: Designed as an introduction for a collection of child pages. It typically contains a title and a summary. Set chapter = true in the Front Matter to enable this.
    2. Default: The standard page type used for all other content.

    Chapters always have the Table of Contents (ToC) disabled.

    +++
    title = "Démarrage"
    weight = 5
    pre = "<b>1. </b>"
    chapter = true
    +++