GithubHelp home page GithubHelp logo

marker's Introduction

marker

Marker is a language that transpiles directly to HTML.

Example

from marker import generate

print(generate('p (style: "color: red") {"Hello, world!"}'))

# Output:
# <p style="color: red">Hello, world!</p>

Syntax

The syntax of Marker is very simple:

tag (attribute: "attribute value") { "tag contents" tag { "another tag" } } # Comment

Which can be expanded to entire HTML documents:

html {
   head {
       title { "Example page" }
   }
   body {
       h1 (id: "header") {
           "Example page!"
       }
       br
       p {
           "1 + 2 = "
           % {1 + 2} # The '%' tag evaluates python code using the 'eval' function and can't contain any newlines.
       }
   }
}

Outputs:

<html>
   <head>
       <title>Example page</title>
   </head>
   <body>
       <h1 id="header">Example page!</h1>
       <br>
       <p>1 + 2 = 3</p>
   </body>
</html>

(Note that the resulting HTML isn't really formatted.)

Usage

In a Python script

from marker import generate

html = generate(marker_code)

From the command line

python3 marker.py [marker code file] [optional output file]

If [optional output file] is omitted, the result will be printed to the terminal.

marker's People

Contributors

mystpi avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 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.