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

WIP: plugins: add custom markdown converter #161

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
2 changes: 2 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,5 @@ gem "bridgetown-sitemap", "~> 2.0"
gem "bridgetown-seo-tag", "~> 6.0"

gem "bridgetown_internal_markdown_links", "~> 0.2.0"

gem "commonmarker"
83 changes: 46 additions & 37 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
GEM
remote: https://rubygems.org/
specs:
activemodel (7.1.3.2)
activesupport (= 7.1.3.2)
activesupport (7.1.3.2)
activemodel (7.2.1)
activesupport (= 7.2.1)
activesupport (7.2.1)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
drb
i18n (>= 1.6, < 2)
logger (>= 1.4.2)
minitest (>= 5.1)
mutex_m
tzinfo (~> 2.0)
addressable (2.8.6)
public_suffix (>= 2.0.2, < 6.0)
securerandom (>= 0.3)
tzinfo (~> 2.0, >= 2.0.5)
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
amazing_print (1.6.0)
base64 (0.2.0)
bigdecimal (3.1.7)
bigdecimal (3.1.8)
bridgetown (1.3.3)
bridgetown-builder (= 1.3.3)
bridgetown-core (= 1.3.3)
Expand Down Expand Up @@ -64,65 +65,72 @@ GEM
bridgetown_internal_markdown_links (0.2.0)
bridgetown (>= 1.2.0, < 2.0)
colorator (1.1.0)
concurrent-ruby (1.2.3)
commonmarker (1.1.5-arm64-darwin)
commonmarker (1.1.5-x86_64-darwin)
commonmarker (1.1.5-x86_64-linux)
concurrent-ruby (1.3.4)
connection_pool (2.4.1)
csv (3.2.8)
csv (3.3.0)
drb (2.2.1)
erubi (1.12.0)
faraday (2.9.0)
faraday-net_http (>= 2.0, < 3.2)
erubi (1.13.0)
faraday (2.11.0)
faraday-net_http (>= 2.0, < 3.4)
logger
faraday-follow_redirects (0.3.0)
faraday (>= 1, < 3)
faraday-net_http (3.1.0)
faraday-net_http (3.3.0)
net-http
ffi (1.16.3)
ffi (1.17.0-arm64-darwin)
ffi (1.17.0-x86_64-darwin)
ffi (1.17.0-x86_64-linux-gnu)
hash_with_dot_access (1.2.0)
activesupport (>= 5.0.0, < 8.0)
i18n (1.14.4)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (5.5.0)
liquid (5.5.1)
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
minitest (5.22.3)
mutex_m (0.2.0)
logger (1.6.1)
minitest (5.25.1)
net-http (0.4.1)
uri
nio4r (2.7.1)
nokogiri (1.16.3-arm64-darwin)
nio4r (2.7.3)
nokogiri (1.16.7-arm64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-darwin)
nokogiri (1.16.7-x86_64-darwin)
racc (~> 1.4)
nokogiri (1.16.3-x86_64-linux)
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
public_suffix (5.0.4)
public_suffix (6.0.1)
puma (6.4.2)
nio4r (~> 2.0)
racc (1.7.3)
rack (3.0.10)
rake (13.1.0)
random-port (0.6.0)
racc (1.8.1)
rack (3.1.7)
rake (13.2.1)
random-port (0.7.1)
rb-fsevent (0.11.2)
rb-inotify (0.10.1)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.2.6)
roda (3.78.0)
rexml (3.3.7)
roda (3.83.0)
rack
rouge (4.2.1)
rouge (4.3.0)
securerandom (0.3.1)
serbea (1.0.1)
activesupport (>= 6.0)
erubi (>= 1.10)
tilt (~> 2.0)
thor (1.3.1)
tilt (2.3.0)
thor (1.3.2)
tilt (2.4.0)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
uri (0.13.0)
zeitwerk (2.6.13)
uri (0.13.1)
zeitwerk (2.6.18)

PLATFORMS
arm64-darwin-21
Expand All @@ -140,6 +148,7 @@ DEPENDENCIES
bridgetown-sitemap (~> 2.0)
bridgetown-svg-inliner (~> 2.0)
bridgetown_internal_markdown_links (~> 0.2.0)
commonmarker
puma (< 7)

BUNDLED WITH
Expand Down
4 changes: 2 additions & 2 deletions bridgetown.config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ collections:
future: true
sort_by: date
sort_direction: descending
kramdown:
parse_html_blocks: true

markdown: Commonmarker
14 changes: 14 additions & 0 deletions plugins/bridgetown/converters/markdown/commonmarker.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
class Bridgetown::Converters::Markdown::Commonmarker
def initialize(config)
require "commonmarker"
@config = config
rescue LoadError
STDERR.puts 'You are missing a library required for Markdown. Please run:'
STDERR.puts ' $ [sudo] gem install commonmarker'
raise RuntimeError.new("Missing dependency: commonmarker")
end

def convert(content)
CommonMarker.render_html(content)
end
end
Loading