jekyll-tidy-json

A Jekyll plugin that cleans JSONs up

MIT License

Downloads
7K
Stars
2
Committers
1

= Jekyll-Tidy-JSON

ifdef::env-github[] image:https://img.shields.io/gem/v/jekyll-tidy-json[ "Gem Version", link="https://rubygems.org/gems/jekyll-tidy-json"] image:https://img.shields.io/github/workflow/status/geolexica/jekyll-tidy-json/Tests[ "Build Status", link="https://github.com/geolexica/jekyll-tidy-json/actions"] endif::[]

A Jekyll plugin that cleans JSONs up.

It takes a JSON page and applies consistent formatting rules to it. If that input is malformed, then raises an exception preventing you from deploying a buggy site.

If you use Liquid templates to build JSONs for your site, then you probably really want it.

== Installation

Include this gem in your site's Gemfile under the jekyll_plugins group:

[source,lang=sh]

group :jekyll_plugins do
gem "jekyll-tidy-json"
end

Visit https://jekyllrb.com/docs/plugins/installation/[Jekyll documentation] for a detailed description or more installation options.

== Configuration

This plugin's behaviour is steered by "tidy_json" entry in site's _config.yml. For example, following enables JSON prettifying:

[source,lang=yaml]

tidy_json:
pretty: true

Available configuration options:

[cols=3*,options="header"] |=== | Option name | Description | Default setting

| continue_on_error | If set to false, any malformed JSON encounter will raise error, preventing site from being built. If set to true, all malformed files are exempted from being tidied up with a meaningful warning being printed, but site generation continues. | false

| enabled | Can be used to disable the plugin entirely by setting it to false. | true

| pretty | If set to true, then JSONs will be prettified for readability sake. If set to false, then all unnecessary spaces and new lines will be removed. | false |===

== TODO

This plugin is fairly complete. However, some enhancements would be welcome:

== Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/geolexica/jekyll-tidy-json.

== Credits

This gem is developed, maintained and funded by https://www.ribose.com[Ribose Inc.]

== License

This gem is licensed under MIT license.

Package Rankings
Top 29.51% on Rubygems.org