https://github.com/unasuke/redcarpet-render-html_lazy_img
Specify "loading" attribute value to converted HTML from markdown.
https://github.com/unasuke/redcarpet-render-html_lazy_img
Last synced: 8 months ago
JSON representation
Specify "loading" attribute value to converted HTML from markdown.
- Host: GitHub
- URL: https://github.com/unasuke/redcarpet-render-html_lazy_img
- Owner: unasuke
- License: mit
- Created: 2019-10-03T10:08:44.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2020-10-28T12:21:34.000Z (over 5 years ago)
- Last Synced: 2025-10-08T04:19:41.172Z (8 months ago)
- Language: Ruby
- Homepage: https://rubygems.org/gems/redcarpet-render-html_lazy_img
- Size: 22.5 KB
- Stars: 4
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Redcarpet::Render::HTMLLazyImg
[](https://travis-ci.org/unasuke/redcarpet-render-html_lazy_img)
[](https://circleci.com/gh/unasuke/redcarpet-render-html_lazy_img/tree/master)
[](https://github.com/unasuke/redcarpet-render-html_lazy_img/actions)


Specify "loading" attribute value to converted HTML from markdown.
You can choose "lazy", "auto", and "eager" to loading attribite by the custom renderer class in `Redcarpet::Markdown.new`.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'redcarpet-render-html_lazy_img'
```
And then execute:
```shell
$ bundle
```
Or install it yourself as:
```shell
$ gem install redcarpet-render-html_lazy_img
```
## Usage
### loading="lazy"
```ruby
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTMLLazyImg::Lazy)
markdown.render('')
# => '

'
```
### loading="auto"
```ruby
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTMLLazyImg::Auto)
markdown.render('')
# => '

'
```
### loading="eager"
```ruby
markdown = Redcarpet::Markdown.new(Redcarpet::Render::HTMLLazyImg::Eager)
markdown.render('')
# => '

'
```
See also [original document of the vmg/redcarpet](https://github.com/vmg/redcarpet#and-you-can-even-cook-your-own).
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/unasuke/redcarpet-render-html_lazy_img. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the Redcarpet::Render::HTMLLazyImg project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/unasuke/redcarpet-render-html_lazy_img/blob/master/CODE_OF_CONDUCT.md).