Sha256: 7064f226c8674c76b91ca533059e34d0848a7b5daa3222ceb07860fcc3984b5f

Contents?: true

Size: 1.62 KB

Versions: 3

Compression:

Stored size: 1.62 KB

Contents

# GOV.UK Markdown renderer

This Ruby gem converts Markdown into [GOV.UK Frontend](https://github.com/alphagov/govuk-frontend)-compliant HTML. It's an extension on the default [Redcarpet renderer](https://github.com/vmg/redcarpet).

Don't confuse this gem with [govspeak](https://github.com/alphagov/govspeak), which is a Markdown dialect specifically built for the GOV.UK publishing system (www.gov.uk).

## Installation

Add this line to your application's Gemfile:

```ruby
gem 'govuk_markdown'
```

## Usage

```rb
GovukMarkdown.render(markdown)
```

For example:

```rb
GovukMarkdown.render("[A link](/foo)")
```

Will output:

```html
<p class="govuk-body-m">
  <a href="/foo" class="govuk-link">A link</a>
</p>
```

## Development

After checking out the repo, run `bin/setup` to install dependencies. 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).

You can regenerate the example HTML file from Markdown using:

```sh
bundle exec rake generate_example
```

## Release a new version

Update the version in [lib/govuk_markdown/version.rb](lib/govuk_markdown/version.rb) and merge to main. This will automatically release a new version using GitHub actions.

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/DfE-digital/govuk_markdown.

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
govuk_markdown-0.4.0 README.md
govuk_markdown-0.3.0 README.md
govuk_markdown-0.2.0 README.md