diff --git a/Gemfile.lock b/Gemfile.lock index b7001d5..b1a747b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,12 +1,12 @@ PATH remote: . specs: - papercraft (1.2) + papercraft (1.3) escape_utils (~> 1.3.0) kramdown (~> 2.5.1) kramdown-parser-gfm (~> 1.1.0) rouge (~> 4.5.1) - sirop (~> 0.4) + sirop (~> 0.5) GEM remote: https://rubygems.org/ @@ -22,7 +22,7 @@ GEM prism (0.27.0) rexml (3.4.0) rouge (4.5.1) - sirop (0.4) + sirop (0.5) prism (~> 0.27.0) tilt (2.2.0) diff --git a/lib/papercraft.rb b/lib/papercraft.rb index 55ebef4..7363fea 100644 --- a/lib/papercraft.rb +++ b/lib/papercraft.rb @@ -1,13 +1,8 @@ # frozen_string_literal: true -require 'kramdown' -require 'rouge' -require 'kramdown-parser-gfm' - require_relative 'papercraft/template' require_relative 'papercraft/renderer' -require_relative 'papercraft/compiler' - +# require_relative 'papercraft/compiler' # Papercraft is a composable templating library module Papercraft @@ -82,6 +77,11 @@ def json(o = nil, mime_type: nil, &template) # @param opts [Hash] Kramdown option overrides # @return [String] HTML def markdown(markdown, **opts) + # require relevant deps on use + require 'kramdown' + require 'rouge' + require 'kramdown-parser-gfm' + opts = default_kramdown_options.merge(opts) Kramdown::Document.new(markdown, **opts).to_html end diff --git a/papercraft.gemspec b/papercraft.gemspec index 1eddc7a..a0c6dff 100644 --- a/papercraft.gemspec +++ b/papercraft.gemspec @@ -21,7 +21,7 @@ Gem::Specification.new do |s| s.require_paths = ["lib"] s.required_ruby_version = '>= 3.2' - s.add_runtime_dependency 'sirop', '~>0.4' + s.add_runtime_dependency 'sirop', '~>0.5' s.add_runtime_dependency 'escape_utils', '~>1.3.0' s.add_runtime_dependency 'kramdown', '~>2.5.1' s.add_runtime_dependency 'rouge', '~>4.5.1' diff --git a/test/fixtures/compiler/defer.html b/test/fixtures/compiler/defer.html new file mode 100644 index 0000000..6e8c77a --- /dev/null +++ b/test/fixtures/compiler/defer.html @@ -0,0 +1 @@ +