https://github.com/timcraft/markababy
Ruby gem for generating HTML
https://github.com/timcraft/markababy
html markaby ruby
Last synced: over 1 year ago
JSON representation
Ruby gem for generating HTML
- Host: GitHub
- URL: https://github.com/timcraft/markababy
- Owner: timcraft
- License: other
- Created: 2011-10-11T11:08:48.000Z (over 14 years ago)
- Default Branch: main
- Last Pushed: 2024-01-11T14:55:49.000Z (over 2 years ago)
- Last Synced: 2025-03-15T23:15:36.722Z (over 1 year ago)
- Topics: html, markaby, ruby
- Language: Ruby
- Homepage:
- Size: 40 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# markababy
[](https://badge.fury.io/rb/markababy) [](https://github.com/timcraft/markababy/actions/workflows/test.yml)
Ruby gem for generating HTML.
## Installation
$ gem install markababy
## Example
Usage is similar to [Markaby](http://en.wikipedia.org/wiki/Markaby),
and easy to use directly from a Ruby script:
```ruby
require 'markababy'
Markababy.markup do
html do
head { title 'Boats.com' }
body do
h1 'Boats.com has great deals'
ul do
li '$49 for a canoe'
li '$39 for a raft'
li '$29 for a huge boot that floats and can fit 5 people'
end
end
end
end
```
Use `Markababy.capture` if you want to capture
the output as a string instead of printing it to STDOUT.
## Rails template usage
Add markababy as a dependency to your Gemfile; do the bundle dance; then change
the extension on your template files from .erb to .rb and you can start writing
your templates in Ruby!
Controller instance variables and helpers will be available as methods.
## Less is more
Some differences from Markaby:
* No auto-stringification
* No element classes or IDs
* No validation
* No XHTML
## Alternatives
* https://github.com/timcraft/hom
* https://github.com/judofyr/tubby
* https://github.com/digital-fabric/rubyoshka