No release in over 3 years
Flexible Jekyll plugin gem that extends Kramdown Markdown parser with customizable AST hooks, enabling enhanced Markdown processing and seamless integration within Jekyll sites.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 13.3
~> 3.13
~> 0.22.0

Runtime

~> 2.5
 Project Readme
EN ru

is-kramdown-hooked

GitHub License Gem Version Ruby Coverage

Extensible Kramdown parser with inner hooks for enhanced Markdown processing in Jekyll.

Version

  • 0.8.0 — pre-release.

About

is-kramdown-hooked is a flexible Ruby gem that extends the standard Kramdown Markdown parser by adding customizable post-parse hooks. These hooks enable developers to inject custom processing steps on the Abstract Syntax Tree (AST) after the default parsing, allowing for advanced Markdown manipulation and seamless integration into Jekyll sites or other Ruby projects using Kramdown.

Features

  • Inherits from Kramdown's parser while allowing registration of multiple post-parse hooks
  • Hooks receive the parser instance to inspect or modify the AST
  • Flexible extension point for custom Markdown transformations
  • Lightweight and easy to integrate as a Jekyll plugin or standalone gem
  • Tested with RSpec and coverage ensured with SimpleCov
  • Compatible with Ruby 3.4 and Kramdown 2.5+

Installation

Add this line to your Jekyll site's Gemfile or any Ruby project's Gemfile:

gem 'is-kramdown-hooked', '~> 0.8.0'

Then run:

bundle install

Usage

Register a post-parse hook in your Ruby code:

Kramdown::Parser::ISKram.register_post_parse_hook do |parser|
  # Custom AST processing logic here
  # Example: modify parser.root to transform Markdown nodes
end

# Parse Markdown source with the custom parser
doc = Kramdown::Document.new(markdown_source, input: 'ISKram')

This will run your hook after the default Kramdown parsing, allowing customized manipulation of the document structure.

Development

Prerequisites

  • Ruby ~> 3.4
  • Bundler
  • Kramdown ~> 2.5

Running tests

To run the test suite, clone the repository and execute:

bundle exec rake

Code coverage is reported using SimpleCov.

Contributing

Contributions are welcome. Please fork the repository and submit pull requests with descriptive commit messages. Ensure all tests pass.

License

This project is licensed under the GPL-3.0-or-later license.

Links