diff --git a/app/liquid_tags/jsitor_tag.rb b/app/liquid_tags/jsitor_tag.rb new file mode 100644 index 000000000..40850d1eb --- /dev/null +++ b/app/liquid_tags/jsitor_tag.rb @@ -0,0 +1,26 @@ +class JsitorTag < LiquidTagBase + PARTIAL = "liquids/jsitor".freeze + + def initialize(tag_name, link_id, token) + super + @link = jsitor_link(link_id.strip) + end + + def render(_context) + ActionController::Base.new.render_to_string( + partial: PARTIAL, + locals: { + link: @link, + height: 600 + }, + ) + end + + private + + def jsitor_link(id) + "https://jsitor.com/embed/#{id}" + end +end + +Liquid::Template.register_tag("jsitor", JsitorTag) diff --git a/app/views/liquids/_jsitor.html.erb b/app/views/liquids/_jsitor.html.erb new file mode 100644 index 000000000..b4b1f50bb --- /dev/null +++ b/app/views/liquids/_jsitor.html.erb @@ -0,0 +1,9 @@ + diff --git a/app/views/pages/_editor_guide_text.html.erb b/app/views/pages/_editor_guide_text.html.erb index d277f7fd7..7adb3abb9 100644 --- a/app/views/pages/_editor_guide_text.html.erb +++ b/app/views/pages/_editor_guide_text.html.erb @@ -328,6 +328,9 @@
All you need is the Asciinema id:
{% asciinema 239367 %}
+ Copy JSitor embeddable link id. It is the last path of the link. ex: https://jsitor.com/embed/1QgJVmCam
+{% jsitor 1QgJVmCam %}
To parse Liquid tags as code, simply wrap it with a single backtick or triple backticks.
`{% mytag %}{{ site.SOMETHING }}{% endmytag %}`