Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Kramdown instead of RDiscount #1

Merged
merged 4 commits into from
Aug 20, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'kramdown'
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GEM
remote: https://rubygems.org/
specs:
kramdown (1.17.0)

PLATFORMS
ruby

DEPENDENCIES
kramdown

BUNDLED WITH
1.16.2
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ At the top of each file is some attributes — lines that start with a `@` sign.

Files are treated according to their suffixes: `.html` means not to process the text; `.markdown` means to use the Markdown renderer.

(Wildcat requires the RDiscount gem for Markdown rendering.)
(Wildcat requires the Kramdown gem for Markdown rendering.)

## Macros

Expand Down Expand Up @@ -54,4 +54,11 @@ TBD

## How to run locally

TBD
Install gem dependencies from `Gemfile`:

```
gem install bundler
bundle install
```

**TBD**
13 changes: 11 additions & 2 deletions utilities/wildcat_file.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Contains the attributes, text, and text type of a file.
# Could be a page, post, or settings file.

require 'rdiscount'
require 'kramdown'
require_relative 'file_parser'
require_relative '../wildcat_constants'

Expand Down Expand Up @@ -43,6 +43,15 @@ def text_type_from_path(path)
end

def render_text
@text_type == TEXT_TYPE_MARKDOWN ? RDiscount.new(@text).to_html : @text
if @text_type == TEXT_TYPE_MARKDOWN
Kramdown::Document.new(
@text,
input: :kramdown,
remove_block_html_tags: false,
transliterated_header_ids: true
).to_html
else
@text
end
end
end