0.0
No commit activity in last 3 years
No release in over 3 years
Kramdown syntax for embedding Rails app served page links
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 1.0.0
~> 2.12.0
~> 0.8.3

Runtime

~> 1.6.0
 Project Readme

kramdown-pages

This gem extends the default kramdown parser with a new block-level element which adds support for embedding Custom Page links in a Markdown document.

Installation

Add this line to your application's Gemfile:

gem 'kramdown-pages'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kramdown-pages

Usage

With standalone kramdown and Rails

  • Ensure you have a Page model that responds to #title and Page::find_by_path, and #path where

    • #title returns the Page title
    • #path returns fully-qualified URL to the page
    • Page::find_by_path returns a Page instance (or nil) given
  • Pass the input option as shown below when initializing a new Kramdown::Document

    Kramdown::Document.new(content, :input => 'KramdownPages')

Syntax

All kramdown supported markup syntax is supported. This gem simply extends the parser to support {page:<permalink>} span-level element. The element will be replaced with an appropriate <a href="page#path">page#title</a> tag.

<permalink> should be replaced with the identifier of the Page you are referencing. The identifier can be hyphenated text, underscored text, or numerical identifier, but cannot contain spaces and special characters. That is, it's regular expression matcher is: [\_\-\/0-9a-zA-Z]+?

Contributing

  1. Fork
  2. Create a topic branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create a new Pull Request

License

MIT License — see MIT-LICENSE for more information