• Stars
    star
    13,178
  • Rank 2,390 (Top 0.05 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 11 years ago
  • Updated 7 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A declarative, HTML-based language that makes building web apps fun

Marko

A declarative, HTML-based language that makes building web apps fun 🔥

NPM Discord Chat Continuous Integration status Code coverage % # of monthly downloads OpenSSF Best Practices

Docs ∙ Try Online ∙ Contribute ∙ Get Support

Intro

Marko is HTML reimagined as a language for building dynamic and reactive user interfaces. Almost any valid HTML is valid Marko, and Marko extends HTML for building modern applications more declaratively. Among these extensions are conditionals and lists, state, and components.

Marko supports both single-file components and components across separate files.

Single-file component

The following renders a button and a counter of how many times the button has been pressed:

click-count.marko

class {
  onCreate() {
    this.state = { count: 0 };
  }
  increment() {
    this.state.count++;
  }
}

style {
  .count {
    color: #09c;
    font-size: 3em;
  }
  .press-me {
    padding: 0.5em;
  }
}

<output.count>
  ${state.count}
</output>
<button.press-me on-click('increment')>
  Press me!
</button>

Multi-file component

The same component as above, but split into:

  • index.marko template file
  • component.js component JS logic file
  • style.css component styles file

index.marko

<output.count>
  ${state.count}
</output>
<button.press-me on-click('increment')>
  Press me!
</button>

component.js

export default {
  onCreate() {
    this.state = { count: 0 };
  },
  increment() {
    this.state.count++;
  },
};

style.css

.count {
  color: #09c;
  font-size: 3em;
}
.press-me {
  padding: 0.5em;
}

Concise Syntax

Marko also supports a beautifully concise syntax as an alternative to its HTML syntax:

Concise syntaxHTML syntax
ul.example-list
  for|color| of=[a, b, c]
    li -- ${color}
<ul class="example-list">
  <for|color| of=[a, b, c]>
    <li>${color}</li>
  </for>
</ul>

Getting Started

  1. npm install marko
  2. Read the docs

Community & Support

Stack Overflow Discord Twitter

Ask and answer StackOverflow questions with the #marko tag

Come hang out in our Discord chat, ask questions, and discuss project direction

Tweet to @MarkoDevTeam, or with the #markojs hashtag

Contributors

Marko would not be what it is without all those who have contributed ✨

All marko-js/marko GitHub contributors

Get Involved!

More Repositories

1

isomorphic-ui-benchmarks

Client/server benchmarks for various UI libraries
JavaScript
245
star
2

htmljs-parser

An HTML parser recognizes content and string placeholders and allows JavaScript expressions as attribute values
TypeScript
137
star
3

templating-benchmarks

Benchmarking framework for multiple templating engines
HTML
135
star
4

run

The Marko application framework
TypeScript
131
star
5

writable-dom

Utility to stream HTML content into a live document.
TypeScript
100
star
6

cli

command-line tools for Marko
JavaScript
94
star
7

examples

54
star
8

vite

A Marko plugin for Vite
TypeScript
53
star
9

micro-frame

A Marko tag for building SSR friendly micro frontends.
HTML
50
star
10

language-server

Marko autocomplete, intellisense and editor support.
TypeScript
38
star
11

website

The markojs.com website
Marko
36
star
12

atom-language-marko

Syntax highlighting in Atom for the Marko templating language
JavaScript
33
star
13

testing-library

Simple and complete Marko testing utilities that encourage good testing practices.
TypeScript
33
star
14

tags

Not quite core components.
JavaScript
22
star
15

tags-api-preview

Preview the Marko 6 "Tags API" in Marko 5!
TypeScript
22
star
16

marko-tmbundle

TextMate bundle for the Marko templating language
Marko
20
star
17

x

experiments. do not use.
TypeScript
19
star
18

rollup

A Marko plugin for Rollup.
TypeScript
16
star
19

markojs.com-legacy

Source code for markojs.com
JavaScript
14
star
20

prettier

A prettier plugin for parsing and printing Marko files.
Marko
13
star
21

webpack

A loader for marko files and a plugin for universal bundling
JavaScript
13
star
22

fastify

Render Marko templates in a Fastify application.
TypeScript
10
star
23

ssr-to-html

Crawl a server rendered application and output html files.
TypeScript
9
star
24

express

Render Marko templates in an express application.
TypeScript
9
star
25

jest

A preprocessor and preset to use Marko with Jest
TypeScript
8
star
26

urql

An isomorphic URQL GraphQL client for Marko
TypeScript
7
star
27

tutorial-blog

Blog site tutorial to demonstrate basic concepts in Marko
Marko
6
star
28

community

Meetings, proposals & other community related discussions
5
star
29

fixture-snapshots

A tool for loading fixtures and creating snapshot tests
TypeScript
5
star
30

marko-migrate

Tool for migrating a project using marko v2 to marko v3
JavaScript
5
star
31

branding

Logos and other graphics for Marko
4
star
32

utils

A set of utilities used by the Marko ecosystem. 🛠
JavaScript
4
star
33

marko-js.github.io

Statically generated files for markojs.com
HTML
4
star
34

screencasts

Project source code associated with Marko screencasts
JavaScript
3
star
35

relative-import-path

Like path.relative for generating short require'able paths.
TypeScript
1
star
36

compat

Marko compat taglibs
JavaScript
1
star
37

markojs-website-v3

Marko v3 website (legacy)
JavaScript
1
star
38

migrate-v3-widget

Migrates a Marko v3 widget to a v4 component.
TypeScript
1
star
39

marko.run

Marko Run website
Marko
1
star