Sha256: 4ecdca9dfee10de1a4e33eed48f2938e4703720f7e810979d34f818775a5cf8a
Contents?: true
Size: 1.35 KB
Versions: 12
Compression:
Stored size: 1.35 KB
Contents
# ------------------------------------------------------------------------------ # ~/_plugins/asciidoctor-extensions/nodebook-block.rb # Asciidoctor extension for J1 Jupyter Notebooks # # Product/Info: # https://jekyll.one # # Copyright (C) 2023, 2024 Juergen Adams # # J1 Template is licensed under the MIT License. # See: https://github.com/jekyll-one-org/j1-template/blob/main/LICENSE.md # ------------------------------------------------------------------------------ # A block macro that embeds a notebook block into the output document # # Usage: # # notebook::notebook_id[role="additional classes"] # # Example|s: # # notebook::j1_test_notebook[] # notebook::j1_test_notebook[role="mt-2 mb-4"] # # ------------------------------------------------------------------------------ require 'asciidoctor/extensions' unless RUBY_ENGINE == 'opal' include Asciidoctor Asciidoctor::Extensions.register do class NbiBlockMacro < Extensions::BlockMacroProcessor use_dsl named :textbook name_positional_attributes 'role' default_attributes 'role' => 'mt-3 mb-3' def process parent, target, attributes html = %( <div id="#{target}" class="nb-textbook speak2me-ignore #{attributes['role']}" data-nb-textbook="initial"></div> ) create_pass_block parent, html, attributes, subs: nil end end block_macro NbiBlockMacro end
Version data entries
12 entries across 12 versions & 1 rubygems