├── .rspec ├── .github ├── FUNDING.yml └── workflows │ ├── release.yml │ └── ci.yml ├── spec ├── fixtures │ ├── docinfo_filter │ │ ├── docinfo.html │ │ ├── docinfo-footer.html │ │ ├── docinfo-header.html │ │ ├── docinfo-custom.html │ │ ├── _config.yml │ │ ├── index.adoc │ │ └── _layouts │ │ │ └── default.html │ ├── basic_site │ │ ├── _config.yml │ │ ├── no-doctitle.adoc │ │ ├── no-liquid.adoc │ │ ├── docid.adoc │ │ ├── with-header-only.adoc │ │ ├── without-front-matter-header.adoc │ │ ├── empty-layout.adoc │ │ ├── nil-layout.adoc │ │ ├── standalone-a.adoc │ │ ├── auto-layout.adoc │ │ ├── bare-header.adoc │ │ ├── custom-layout.adoc │ │ ├── standalone-b.adoc │ │ ├── with-front-matter-header-only.adoc │ │ ├── empty-page-attribute.adoc │ │ ├── liquid-enabled-asciidoc-header.adoc │ │ ├── liquid-enabled-front-matter.adoc │ │ ├── not-published.adoc │ │ ├── with-front-matter-header.adoc │ │ ├── section-with-id-and-role.adoc │ │ ├── subdir │ │ │ └── page-in-subdir.adoc │ │ └── _layouts │ │ │ ├── custom.html │ │ │ └── page.html │ ├── read_error │ │ ├── _config.yml │ │ └── unreadable.adoc │ ├── default_config │ │ └── _config.yml │ ├── tocify_filter │ │ ├── _config.yml │ │ ├── index.adoc │ │ └── _layouts │ │ │ └── default.html │ ├── asciidocify_filter │ │ ├── _config.yml │ │ ├── index.adoc │ │ └── _layouts │ │ │ └── default.html │ ├── fallback_to_default_layout │ │ ├── home.adoc │ │ ├── _blueprints │ │ │ └── blueprint.adoc │ │ ├── _posts │ │ │ └── 2016-01-01-post.adoc │ │ ├── _config.yml │ │ └── _layouts │ │ │ └── default.html │ ├── include_relative_to_docdir │ │ ├── _child.adoc │ │ ├── parent.adoc │ │ ├── about │ │ │ ├── _people.adoc │ │ │ └── index.adoc │ │ ├── _config.yml │ │ └── _layouts │ │ │ └── default.html │ ├── with_posts │ │ ├── _posts │ │ │ ├── 2016-05-31-automatic-title.adoc │ │ │ ├── 2016-01-05-nil-layout.adoc │ │ │ ├── 2016-01-02-empty-layout.adoc │ │ │ ├── 2016-01-03-auto-layout.adoc │ │ │ ├── 2016-01-04-custom-layout.adoc │ │ │ ├── 2016-04-01-show-me-the-title.adoc │ │ │ ├── 2016-01-01-welcome.adoc │ │ │ ├── 2016-06-15-post-with-date.adoc │ │ │ ├── 2016-02-01-post-with-categories.adoc │ │ │ ├── 2016-03-02-post-with-excerpt-doctype.adoc │ │ │ ├── 2016-03-01-post-with-excerpt.adoc │ │ │ ├── 2016-07-15-post-with-date-and-tz.adoc │ │ │ ├── 2016-03-03-post-with-synopsis.adoc │ │ │ ├── 2016-02-02-post-with-singular-vars.adoc │ │ │ └── 2016-07-20-post-with-date-in-revision-line.adoc │ │ ├── _drafts │ │ │ └── a-draft-post.adoc │ │ ├── _config.yml │ │ ├── _layouts │ │ │ ├── custom.html │ │ │ └── post.html │ │ └── index.html │ ├── posts_with_excerpts │ │ ├── plain │ │ │ └── _config.yml │ │ ├── _posts │ │ │ ├── 2018-01-08-header-only.adoc │ │ │ ├── 2018-01-03-single-paragraph-only.adoc │ │ │ ├── 2018-01-09-no-liquid.adoc │ │ │ ├── 2018-01-01-header-and-single-paragraph.adoc │ │ │ ├── 2018-01-10-with-liquid.adoc │ │ │ ├── 2018-01-11-standalone-layout.adoc │ │ │ ├── 2018-01-04-multiple-paragraphs-only.adoc │ │ │ ├── 2018-01-07-blank-excerpt.adoc │ │ │ ├── 2018-01-02-header-and-multiple-paragraphs.adoc │ │ │ ├── 2018-01-05-excerpt-in-header.adoc │ │ │ └── 2018-01-06-excerpt-in-front-matter.adoc │ │ ├── with_plugin │ │ │ └── _config.yml │ │ ├── _layouts │ │ │ └── post.html │ │ └── index.html │ ├── include_relative_to_source │ │ ├── about │ │ │ ├── _people.adoc │ │ │ └── index.adoc │ │ ├── _config.yml │ │ └── _layouts │ │ │ └── default.html │ ├── site_wide_fallback_layout │ │ ├── not-set.adoc │ │ ├── in-asciidoc-header.adoc │ │ ├── in-front-matter.adoc │ │ ├── _config.yml │ │ └── _layouts │ │ │ ├── simple.html │ │ │ └── default.html │ ├── front_matter_defaults │ │ ├── docs │ │ │ └── page.adoc │ │ ├── page.adoc │ │ ├── _config.yml │ │ └── _layouts │ │ │ ├── docs.html │ │ │ └── general.html │ ├── include_relative_to_root │ │ ├── source │ │ │ ├── about │ │ │ │ ├── _people.adoc │ │ │ │ └── index.adoc │ │ │ └── _layouts │ │ │ │ └── default.html │ │ └── _config.yml │ ├── explicit_site_time │ │ ├── home.adoc │ │ ├── _config.yml │ │ └── _layouts │ │ │ └── default.html │ ├── unpublished_site_config │ │ ├── _config.yml │ │ └── not-published.adoc │ ├── require_front_matter_header │ │ ├── without-front-matter-header.adoc │ │ ├── with-front-matter-header.adoc │ │ ├── _config.yml │ │ └── _layouts │ │ │ └── default.html │ ├── safe_mode │ │ ├── _config.yml │ │ ├── home.adoc │ │ └── _layouts │ │ │ └── home.html │ ├── blank_page_attribute_prefix │ │ ├── _config.yml │ │ ├── explicit-permalink.adoc │ │ └── _layouts │ │ │ └── default.html │ ├── xhtml_syntax │ │ ├── home.adoc │ │ ├── images │ │ │ └── sunset.jpg │ │ └── _config.yml │ ├── alternate_page_attribute_prefix │ │ ├── _config.yml │ │ ├── explicit-permalink.adoc │ │ └── _layouts │ │ │ └── default.html │ ├── imagesdir_relative_to_root │ │ ├── _config.yml │ │ └── with_baseurl │ │ │ └── _config.yml │ ├── site_wide_standalone_layout │ │ ├── _config.yml │ │ └── standalone.adoc │ ├── with_custom_collection │ │ ├── _blueprints │ │ │ ├── blueprint-a.adoc │ │ │ └── blueprint-b.adoc │ │ ├── _config.yml │ │ └── _layouts │ │ │ ├── default.html │ │ │ └── blueprint.html │ ├── with_custom_private_collection │ │ ├── _tips │ │ │ ├── current-branch.adoc │ │ │ └── needle-in-haystack.adoc │ │ ├── _config.yml │ │ └── index.html │ ├── legacy_config │ │ └── _config.yml │ ├── implicit_page_variables │ │ ├── string │ │ │ └── _config.yml │ │ ├── single_line_array │ │ │ └── _config.yml │ │ ├── array │ │ │ └── _config.yml │ │ ├── index.adoc │ │ └── _layouts │ │ │ └── default.html │ ├── attributes_as_array │ │ └── _config.yml │ ├── custom_excerpt_separator │ │ ├── _config.yml │ │ ├── _posts │ │ │ ├── 2018-01-02-asciidoc.adoc │ │ │ └── 2018-01-01-markdown.md │ │ ├── _layouts │ │ │ └── post.html │ │ └── index.html │ ├── pygments_code_highlighting │ │ ├── _config.yml │ │ ├── page-with-code.adoc │ │ └── _layouts │ │ │ └── page.html │ ├── merged_attributes │ │ ├── no-merge.adoc │ │ ├── merge.adoc │ │ ├── _layouts │ │ │ └── default.html │ │ └── _config.yml │ ├── hybrid_config │ │ └── _config.yml │ └── attributes_as_hash │ │ └── _config.yml └── spec_helper.rb ├── .simplecov ├── Rakefile ├── lib ├── jekyll-asciidoc │ ├── version.rb │ ├── jekyll_ext.rb │ ├── mixins.rb │ ├── jekyll_ext │ │ ├── renderer │ │ │ └── layouts.rb │ │ ├── site │ │ │ └── find_generator_instance.rb │ │ └── drops │ │ │ └── drop.rb │ ├── utils.rb │ ├── excerpt.rb │ ├── filters.rb │ ├── integrator.rb │ └── converter.rb └── jekyll-asciidoc.rb ├── .deep_cover.rb ├── .gitignore ├── .yardopts ├── docs ├── modules │ └── ROOT │ │ ├── pages │ │ ├── blog.adoc │ │ ├── disabling-pub.adoc │ │ ├── glossary.adoc │ │ ├── safe-mode.adoc │ │ ├── asciidoctor.adoc │ │ ├── drafts.adoc │ │ ├── about.adoc │ │ ├── classifying.adoc │ │ ├── community.adoc │ │ ├── index.adoc │ │ ├── issues.adoc │ │ ├── hard-line-breaks.adoc │ │ ├── time.adoc │ │ ├── asciidoc.adoc │ │ ├── build.adoc │ │ ├── base-dir.adoc │ │ ├── doctitle.adoc │ │ ├── configuration.adoc │ │ ├── layout.adoc │ │ ├── intrinsic-attributes.adoc │ │ ├── liquid-attributes.adoc │ │ ├── liquid.adoc │ │ ├── excerpts.adoc │ │ ├── pages.adoc │ │ ├── stem.adoc │ │ ├── extensions.adoc │ │ ├── implicit-page-vars.adoc │ │ ├── templates.adoc │ │ ├── installation.adoc │ │ ├── global-page-attributes.adoc │ │ ├── page-attributes.adoc │ │ ├── liquid-filters.adoc │ │ ├── development.adoc │ │ ├── publishing.adoc │ │ ├── supplemental-assets.adoc │ │ └── asciidoctor-diagram.adoc │ │ └── nav.adoc └── antora.yml ├── tasks ├── bundler.rake ├── rubocop.rake ├── rspec.rake └── version.rb ├── Gemfile ├── LICENSE ├── release.sh ├── jekyll-asciidoc.gemspec ├── coding-style-guide.adoc └── CHANGELOG.adoc /.rspec: -------------------------------------------------------------------------------- 1 | --require ./spec/spec_helper 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | open_collective: asciidoctor 2 | -------------------------------------------------------------------------------- /spec/fixtures/docinfo_filter/docinfo.html: -------------------------------------------------------------------------------- 1 |
this is the head
-------------------------------------------------------------------------------- /spec/fixtures/basic_site/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | -------------------------------------------------------------------------------- /spec/fixtures/read_error/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/no-doctitle.adoc: -------------------------------------------------------------------------------- 1 | Just content. 2 | Lorem ipsum. 3 | -------------------------------------------------------------------------------- /spec/fixtures/default_config/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | -------------------------------------------------------------------------------- /spec/fixtures/tocify_filter/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | -------------------------------------------------------------------------------- /spec/fixtures/asciidocify_filter/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/no-liquid.adoc: -------------------------------------------------------------------------------- 1 | = No Liquid 2 | 3 | {{ page.title }} 4 | -------------------------------------------------------------------------------- /spec/fixtures/docinfo_filter/docinfo-footer.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /spec/fixtures/docinfo_filter/docinfo-header.html: -------------------------------------------------------------------------------- 1 |
this is the header
-------------------------------------------------------------------------------- /spec/fixtures/fallback_to_default_layout/home.adoc: -------------------------------------------------------------------------------- 1 | = Page 2 | 3 | Lorem ipsum. 4 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_docdir/_child.adoc: -------------------------------------------------------------------------------- 1 | :name: value 2 | {name} 3 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_docdir/parent.adoc: -------------------------------------------------------------------------------- 1 | include::_child.adoc[] 2 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-05-31-automatic-title.adoc: -------------------------------------------------------------------------------- 1 | Lorem ipsum. 2 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/docid.adoc: -------------------------------------------------------------------------------- 1 | [#page-id] 2 | = Page Title 3 | 4 | content 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/with-header-only.adoc: -------------------------------------------------------------------------------- 1 | = Header Only 2 | :page-layout: page 3 | -------------------------------------------------------------------------------- /spec/fixtures/docinfo_filter/docinfo-custom.html: -------------------------------------------------------------------------------- 1 |
this is custom
-------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/plain/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | -------------------------------------------------------------------------------- /spec/fixtures/read_error/unreadable.adoc: -------------------------------------------------------------------------------- 1 | = Unreadable Page 2 | 3 | Lorem ipsum. 4 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_docdir/about/_people.adoc: -------------------------------------------------------------------------------- 1 | * Doc Writer 2 | * Word Smith 3 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_source/about/_people.adoc: -------------------------------------------------------------------------------- 1 | * Doc Writer 2 | * Word Smith 3 | -------------------------------------------------------------------------------- /spec/fixtures/site_wide_fallback_layout/not-set.adoc: -------------------------------------------------------------------------------- 1 | = Page Title 2 | 3 | Lorem ipsum. 4 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/without-front-matter-header.adoc: -------------------------------------------------------------------------------- 1 | = Page Title 2 | 3 | Lorem ipsum. 4 | -------------------------------------------------------------------------------- /spec/fixtures/front_matter_defaults/docs/page.adoc: -------------------------------------------------------------------------------- 1 | = Docs Page 2 | 3 | Content of docs page. 4 | -------------------------------------------------------------------------------- /spec/fixtures/front_matter_defaults/page.adoc: -------------------------------------------------------------------------------- 1 | = General Page 2 | 3 | Content of general page. 4 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_root/source/about/_people.adoc: -------------------------------------------------------------------------------- 1 | * Doc Writer 2 | * Word Smith 3 | -------------------------------------------------------------------------------- /spec/fixtures/explicit_site_time/home.adoc: -------------------------------------------------------------------------------- 1 | = Home Page 2 | 3 | * localdatetime={localdatetime} 4 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/empty-layout.adoc: -------------------------------------------------------------------------------- 1 | = Auto Page Layout 2 | :page-layout: 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/nil-layout.adoc: -------------------------------------------------------------------------------- 1 | = Nil Page Layout 2 | :page-layout: ~ 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/standalone-a.adoc: -------------------------------------------------------------------------------- 1 | = Standalone Page A 2 | :page-layout!: 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/fallback_to_default_layout/_blueprints/blueprint.adoc: -------------------------------------------------------------------------------- 1 | = Blueprint 2 | 3 | Lorem ipsum. 4 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_root/_config.yml: -------------------------------------------------------------------------------- 1 | source: source 2 | plugins: 3 | - jekyll-asciidoc 4 | -------------------------------------------------------------------------------- /spec/fixtures/unpublished_site_config/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | unpublished: true 4 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/auto-layout.adoc: -------------------------------------------------------------------------------- 1 | = Auto Page Layout 2 | :page-layout: _auto 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/bare-header.adoc: -------------------------------------------------------------------------------- 1 | :page-permalink: /bare/ 2 | 3 | Just content. 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/custom-layout.adoc: -------------------------------------------------------------------------------- 1 | = Custom Layout 2 | :page-layout: custom 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/standalone-b.adoc: -------------------------------------------------------------------------------- 1 | = Standalone Page B 2 | :page-layout: false 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-08-header-only.adoc: -------------------------------------------------------------------------------- 1 | = AsciiDoc Header Only 2 | Author Name 3 | -------------------------------------------------------------------------------- /spec/fixtures/require_front_matter_header/without-front-matter-header.adoc: -------------------------------------------------------------------------------- 1 | = Page Title 2 | 3 | Lorem ipsum. 4 | -------------------------------------------------------------------------------- /spec/fixtures/fallback_to_default_layout/_posts/2016-01-01-post.adoc: -------------------------------------------------------------------------------- 1 | = Post 2 | Henry Jekyll 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/with_plugin/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | - jekyll-mentions 4 | -------------------------------------------------------------------------------- /spec/fixtures/safe_mode/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: &plugins 2 | - jekyll-asciidoc 3 | safe: true 4 | whitelist: *plugins 5 | -------------------------------------------------------------------------------- /spec/fixtures/safe_mode/home.adoc: -------------------------------------------------------------------------------- 1 | = Home Page 2 | :page-layout: home 3 | :imagesdir: images 4 | 5 | Lorem ipsum. 6 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-01-05-nil-layout.adoc: -------------------------------------------------------------------------------- 1 | = Nil Layout 2 | :page-layout: ~ 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/with-front-matter-header-only.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | title: Front Matter Only 3 | layout: page 4 | --- 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-01-02-empty-layout.adoc: -------------------------------------------------------------------------------- 1 | = Empty Layout 2 | :page-layout: 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-01-03-auto-layout.adoc: -------------------------------------------------------------------------------- 1 | = Auto Layout 2 | :page-layout: _auto 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /.simplecov: -------------------------------------------------------------------------------- 1 | SimpleCov.start do 2 | add_filter %w(/.bundle/ /spec/) 3 | coverage_dir 'coverage/report-simplecov' 4 | end 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/empty-page-attribute.adoc: -------------------------------------------------------------------------------- 1 | = Page Title 2 | :page-attribute-with-empty-value: 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/liquid-enabled-asciidoc-header.adoc: -------------------------------------------------------------------------------- 1 | = Liquid Enabled 2 | :page-liquid: 3 | 4 | {{ page.title }} 5 | -------------------------------------------------------------------------------- /spec/fixtures/explicit_site_time/_config.yml: -------------------------------------------------------------------------------- 1 | time: 2016-07-04T09:15:00 2 | timezone: UTC 3 | plugins: 4 | - jekyll-asciidoc 5 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_docdir/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoctor: 4 | base_dir: :docdir 5 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_source/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoctor: 4 | base_dir: :source 5 | -------------------------------------------------------------------------------- /spec/fixtures/require_front_matter_header/with-front-matter-header.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | = Page Title 4 | 5 | Lorem ipsum. 6 | -------------------------------------------------------------------------------- /spec/fixtures/site_wide_fallback_layout/in-asciidoc-header.adoc: -------------------------------------------------------------------------------- 1 | = Page Title 2 | :page-layout: simple 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-01-04-custom-layout.adoc: -------------------------------------------------------------------------------- 1 | = Custom Layout 2 | :page-layout: custom 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-04-01-show-me-the-title.adoc: -------------------------------------------------------------------------------- 1 | = Show Me the Title 2 | :showtitle: 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/blank_page_attribute_prefix/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoc: 4 | page_attribute_prefix: ~ 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_drafts/a-draft-post.adoc: -------------------------------------------------------------------------------- 1 | = A Draft Post 2 | Henry Jekyll 3 | :page-tags: [draft] 4 | 5 | Lorem ipsum. 6 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/liquid-enabled-front-matter.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | liquid: true 3 | --- 4 | = Liquid Enabled 5 | 6 | {{ page.title }} 7 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/not-published.adoc: -------------------------------------------------------------------------------- 1 | = Not Published 2 | :page-published: false 3 | 4 | This page should not be published. 5 | -------------------------------------------------------------------------------- /spec/fixtures/docinfo_filter/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoctor: 4 | base_dir: :source 5 | # base_dir: spec 6 | -------------------------------------------------------------------------------- /spec/fixtures/site_wide_fallback_layout/in-front-matter.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | layout: simple 3 | --- 4 | = Page Title 5 | 6 | Lorem ipsum. 7 | -------------------------------------------------------------------------------- /spec/fixtures/xhtml_syntax/home.adoc: -------------------------------------------------------------------------------- 1 | = Home Page 2 | :imagesdir: images 3 | :!page-layout: 4 | 5 | image::sunset.jpg[Sunset,408,230] 6 | -------------------------------------------------------------------------------- /Rakefile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | Dir['tasks/*.rake'].each {|rakefile| load rakefile } 4 | task default: %w(spec lint build) 5 | -------------------------------------------------------------------------------- /spec/fixtures/alternate_page_attribute_prefix/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoc: 4 | page_attribute_prefix: jekyll- 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/with-front-matter-header.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | title: Original Page Title 3 | --- 4 | = Page Title 5 | 6 | Lorem ipsum. 7 | -------------------------------------------------------------------------------- /spec/fixtures/fallback_to_default_layout/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | collections: 4 | blueprints: 5 | output: true 6 | -------------------------------------------------------------------------------- /spec/fixtures/require_front_matter_header/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoc: 4 | require_front_matter_header: true 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-01-01-welcome.adoc: -------------------------------------------------------------------------------- 1 | = Welcome, Visitor! 2 | Henry Jekyll 3 | 4 | Welcome to my Jekyll-powered blog! 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-06-15-post-with-date.adoc: -------------------------------------------------------------------------------- 1 | = Post With Date 2 | :revdate: 2016-06-15 10:30:00 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/section-with-id-and-role.adoc: -------------------------------------------------------------------------------- 1 | = Page Title 2 | 3 | [#section-id.section-role] 4 | == Section Title 5 | 6 | content 7 | -------------------------------------------------------------------------------- /spec/fixtures/blank_page_attribute_prefix/explicit-permalink.adoc: -------------------------------------------------------------------------------- 1 | = Page With Explicit Permalink 2 | :permalink: /permalink/ 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/imagesdir_relative_to_root/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoctor: 4 | attributes: 5 | imagesdir: /images@ 6 | -------------------------------------------------------------------------------- /spec/fixtures/site_wide_fallback_layout/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoctor: 4 | attributes: 5 | - page-layout=default@ 6 | -------------------------------------------------------------------------------- /spec/fixtures/site_wide_standalone_layout/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoctor: 4 | attributes: 5 | page-layout: false 6 | -------------------------------------------------------------------------------- /spec/fixtures/with_custom_collection/_blueprints/blueprint-a.adoc: -------------------------------------------------------------------------------- 1 | = First Blueprint 2 | :revdate: 2018-01-01 3 | :page-foo: bar 4 | 5 | Lorem ipsum. 6 | -------------------------------------------------------------------------------- /spec/fixtures/xhtml_syntax/images/sunset.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/asciidoctor/jekyll-asciidoc/HEAD/spec/fixtures/xhtml_syntax/images/sunset.jpg -------------------------------------------------------------------------------- /spec/fixtures/asciidocify_filter/index.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | summary: A *very* welcoming _welcome_ page. 3 | --- 4 | = Welcome 5 | 6 | Welcome, welcome, welcome! 7 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-02-01-post-with-categories.adoc: -------------------------------------------------------------------------------- 1 | = Post With Categories 2 | :page-categories: [code, javascript] 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/xhtml_syntax/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoctor: 4 | backend: xhtml 5 | attributes: 6 | - imagesdir=/images 7 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc/version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Jekyll 4 | module AsciiDoc 5 | VERSION = '3.1.0-alpha.0' 6 | end 7 | end 8 | -------------------------------------------------------------------------------- /spec/fixtures/alternate_page_attribute_prefix/explicit-permalink.adoc: -------------------------------------------------------------------------------- 1 | = Page With Explicit Permalink 2 | :jekyll-permalink: /permalink/ 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-03-single-paragraph-only.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | title: Paragraph Only 3 | --- 4 | This is the excerpt and body text. 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_custom_private_collection/_tips/current-branch.adoc: -------------------------------------------------------------------------------- 1 | = Current Branch 2 | :page-language: git 3 | 4 | $ git rev-parse --abbrev-ref HEAD 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-03-02-post-with-excerpt-doctype.adoc: -------------------------------------------------------------------------------- 1 | = Post With Excerpt Doctype 2 | :page-excerpt_doctype: article 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/legacy_config/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoc: asciidoctor 4 | asciidoc_ext: adoc 5 | asciidoc_page_attribute_prefix: jekyll 6 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-09-no-liquid.adoc: -------------------------------------------------------------------------------- 1 | = No Liquid 2 | Author Name 3 | 4 | {{ page.title }} 5 | 6 | This is not part of the excerpt. 7 | -------------------------------------------------------------------------------- /spec/fixtures/with_custom_private_collection/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | collections: 4 | tips: {} 5 | asciidoctor: 6 | base_dir: :docdir 7 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-03-01-post-with-excerpt.adoc: -------------------------------------------------------------------------------- 1 | = Post With Excerpt 2 | :page-excerpt: This is the _excerpt_ of this post. 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-07-15-post-with-date-and-tz.adoc: -------------------------------------------------------------------------------- 1 | = Post With Date and Time Zone 2 | :revdate: 2016-07-15 04:15:30 -0600 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/subdir/page-in-subdir.adoc: -------------------------------------------------------------------------------- 1 | = Page In Subdir 2 | 3 | Lorem ipsum. 4 | 5 | * docfile={docfile} 6 | * docdir={docdir} 7 | * docname={docname} 8 | -------------------------------------------------------------------------------- /spec/fixtures/docinfo_filter/index.adoc: -------------------------------------------------------------------------------- 1 | = Page Title 2 | :docinfo: shared 3 | //:docinfodir: spec/fixtures/docinfo_filter 4 | 5 | == Major Section A 6 | 7 | content 8 | -------------------------------------------------------------------------------- /spec/fixtures/implicit_page_variables/string/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | 4 | asciidoc: 5 | implicit_page_variables: surprising, un-expected, when 6 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-03-03-post-with-synopsis.adoc: -------------------------------------------------------------------------------- 1 | = Post With Synopsis 2 | :page-synopsis: This is the _synopsis_ of this post. 3 | 4 | Lorem ipsum. 5 | -------------------------------------------------------------------------------- /spec/fixtures/attributes_as_array/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoctor: 4 | attributes: 5 | - icons=font 6 | - sectanchors 7 | - table-caption! 8 | -------------------------------------------------------------------------------- /spec/fixtures/custom_excerpt_separator/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | excerpt_separator: "" 4 | asciidoc: 5 | excerpt_separator: "\n//more\n" 6 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-01-header-and-single-paragraph.adoc: -------------------------------------------------------------------------------- 1 | = Header and Single Paragraph 2 | Author Name 3 | 4 | This is the excerpt and body text. 5 | -------------------------------------------------------------------------------- /spec/fixtures/pygments_code_highlighting/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoctor: 4 | attributes: 5 | - stylesdir=/css 6 | - source-highlighter=pygments@ 7 | -------------------------------------------------------------------------------- /spec/fixtures/unpublished_site_config/not-published.adoc: -------------------------------------------------------------------------------- 1 | = Not Published 2 | :page-published: false 3 | 4 | This page should be published only when unpublished config is given. 5 | -------------------------------------------------------------------------------- /spec/fixtures/with_custom_collection/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | collections: 4 | blueprints: 5 | output: true 6 | asciidoctor: 7 | base_dir: :docdir 8 | -------------------------------------------------------------------------------- /.deep_cover.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | DeepCover.configure do 4 | output 'coverage/report-deep-cover' 5 | paths %w(lib) 6 | reporter :text if ENV['CI'] 7 | end 8 | -------------------------------------------------------------------------------- /spec/fixtures/implicit_page_variables/single_line_array/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | 4 | asciidoc: 5 | implicit_page_variables: [surprising, un-expected, when] 6 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-10-with-liquid.adoc: -------------------------------------------------------------------------------- 1 | = With Liquid 2 | Author Name 3 | :page-liquid: 4 | 5 | {{ page.title }} 6 | 7 | This is not part of the excerpt. 8 | -------------------------------------------------------------------------------- /spec/fixtures/imagesdir_relative_to_root/with_baseurl/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | baseurl: /projectname 4 | asciidoctor: 5 | attributes: 6 | imagesdir: /images@ 7 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /.ruby-* 2 | /*.gem 3 | /.bundle/ 4 | /.yardoc/ 5 | /build/ 6 | /coverage/ 7 | /deep_cover/ 8 | /pkg/ 9 | /rdoc/ 10 | /Gemfile.lock 11 | .nyc_output 12 | .idea 13 | *.iml 14 | -------------------------------------------------------------------------------- /spec/fixtures/implicit_page_variables/array/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | 4 | asciidoc: 5 | implicit_page_variables: 6 | - surprising 7 | - un-expected 8 | - when 9 | -------------------------------------------------------------------------------- /spec/fixtures/with_custom_private_collection/_tips/needle-in-haystack.adoc: -------------------------------------------------------------------------------- 1 | = Needle In Haystack 2 | :page-language: js 3 | 4 | [source,js] 5 | ---- 6 | if (~haystack.indexOf(needle)) { /* present */ } 7 | ---- 8 | -------------------------------------------------------------------------------- /spec/fixtures/merged_attributes/no-merge.adoc: -------------------------------------------------------------------------------- 1 | = Page with merged_attributes, no overrides 2 | 3 | Ludicrous content! 4 | 5 | {page-attr} 6 | 7 | {page-complex} 8 | 9 | {implicit1} 10 | 11 | {implicit2} 12 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-11-standalone-layout.adoc: -------------------------------------------------------------------------------- 1 | = Standalone 2 | Author Name 3 | :page-layout: false 4 | 5 | Excerpt of post with standalone layout. 6 | 7 | This is not part of the excerpt. 8 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc/jekyll_ext.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require_relative 'jekyll_ext/drops/drop' 4 | require_relative 'jekyll_ext/renderer/layouts' 5 | require_relative 'jekyll_ext/site/find_generator_instance' 6 | -------------------------------------------------------------------------------- /spec/fixtures/front_matter_defaults/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | defaults: 4 | - values: 5 | layout: general 6 | - scope: 7 | path: docs 8 | type: pages 9 | values: 10 | layout: docs 11 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-04-multiple-paragraphs-only.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | title: Multiple Paragraphs Only 3 | --- 4 | This is the _excerpt_. 5 | 6 | This is the rest of the body text that comes after the excerpt. 7 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-07-blank-excerpt.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | excerpt_separator: '' 3 | --- 4 | = Blank Excerpt 5 | Author Name 6 | 7 | This document has a blank excerpt because the excerpt_separator is blank. 8 | -------------------------------------------------------------------------------- /spec/fixtures/hybrid_config/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoc_ext: adoc 4 | asciidoc_page_attribute_prefix: jekyll 5 | asciidoc: 6 | processor: asciidoctor 7 | ext: asciidoc,adoc 8 | page_attribute_prefix: pg 9 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-02-header-and-multiple-paragraphs.adoc: -------------------------------------------------------------------------------- 1 | = Header and Multiple Paragraphs 2 | Author Name 3 | 4 | This is the excerpt. 5 | 6 | This is the rest of the body text that comes after the excerpt. 7 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-05-excerpt-in-header.adoc: -------------------------------------------------------------------------------- 1 | = Excerpt in Header 2 | :page-excerpt: This is the _excerpt_. 3 | 4 | This is the first paragraph, but not the excerpt. 5 | 6 | This is the rest of the body text. 7 | -------------------------------------------------------------------------------- /spec/fixtures/site_wide_standalone_layout/standalone.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | layout: overridden 3 | --- 4 | // standalone because page-layout=false is set in site config 5 | = Standalone Page 6 | :page-layout: also-overridden 7 | 8 | Lorem ipsum. 9 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-02-02-post-with-singular-vars.adoc: -------------------------------------------------------------------------------- 1 | = Post With Categories 2 | :page-category: code 3 | :page-categories: [node, javascript] 4 | :page-tag: syntax 5 | :page-tags: [tip, beginner] 6 | 7 | Lorem ipsum. 8 | -------------------------------------------------------------------------------- /spec/fixtures/attributes_as_hash/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoc: 4 | processor: asciidoctor 5 | attributes: 6 | icons: font 7 | asciidoctor: 8 | attributes: 9 | sectanchors: '' 10 | table-caption: null 11 | -------------------------------------------------------------------------------- /spec/fixtures/custom_excerpt_separator/_posts/2018-01-02-asciidoc.adoc: -------------------------------------------------------------------------------- 1 | = Excerpt Separator in AsciiDoc 2 | 3 | This is part of the excerpt. 4 | 5 | This is also part of the excerpt. 6 | 7 | //more 8 | 9 | This is not part of the excerpt. 10 | -------------------------------------------------------------------------------- /.yardopts: -------------------------------------------------------------------------------- 1 | --charset UTF-8 2 | --readme README.adoc 3 | --no-private 4 | --hide-api private 5 | --title "Jekyll AsciiDoc API Docs" 6 | --output-dir apidoc 7 | --exclude /(?:core|jekyll)_ext/ 8 | lib/**/*.rb 9 | - 10 | CHANGELOG.adoc 11 | LICENSE.adoc 12 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_posts/2018-01-06-excerpt-in-front-matter.adoc: -------------------------------------------------------------------------------- 1 | --- 2 | excerpt: This is the _excerpt_. 3 | --- 4 | = Excerpt in Header 5 | 6 | This is the first paragraph, but not the excerpt. 7 | 8 | This is the rest of the body text. 9 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_root/source/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ page.title }} 5 | 6 | 7 |
8 | {{ content }} 9 |
10 | 11 | 12 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_source/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ page.title }} 5 | 6 | 7 |
8 | {{ content }} 9 |
10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/with_custom_collection/_blueprints/blueprint-b.adoc: -------------------------------------------------------------------------------- 1 | = Second Blueprint 2 | :page-layout: default 3 | 4 | Lorem ipsum. 5 | 6 | * docfile={docfile} 7 | * docdir={docdir} 8 | * outfile={outfile} 9 | * outdir={outdir} 10 | * outpath={outpath} 11 | -------------------------------------------------------------------------------- /spec/fixtures/explicit_site_time/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_posts/2016-07-20-post-with-date-in-revision-line.adoc: -------------------------------------------------------------------------------- 1 | = Post With Date in Revision Line 2 | Author Name 3 | // NOTE cannot use colon in date because it's used as the delimiter for the revision remark 4 | 2016-07-20 05h45m25s -0600 5 | 6 | Lorem ipsum. 7 | -------------------------------------------------------------------------------- /spec/fixtures/blank_page_attribute_prefix/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/require_front_matter_header/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/blog.adoc: -------------------------------------------------------------------------------- 1 | = Jekyll Blog Support 2 | 3 | Jekyll has built-in support for several features related to blogs: 4 | 5 | * Tags and categories 6 | * Revision date 7 | * Drafts 8 | 9 | This section details how to take advantage of these features with Asciidoc documents. -------------------------------------------------------------------------------- /spec/fixtures/alternate_page_attribute_prefix/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/custom_excerpt_separator/_posts/2018-01-01-markdown.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: Excerpt Separator in Markdown 3 | layout: post 4 | --- 5 | This is part of the excerpt. 6 | 7 | This is also part of the excerpt. 8 | 9 | 10 | 11 | This is not part of the excerpt. 12 | -------------------------------------------------------------------------------- /spec/fixtures/implicit_page_variables/index.adoc: -------------------------------------------------------------------------------- 1 | = Implicit Page Variables 2 | :surprising: It is surprising that 3 | :un-expected: an unexpected event could occur 4 | :when: when programming Ruby. 5 | :page-when: when writing in AsciiDoc. 6 | :not-implicit: Surprise! 7 | 8 | Lorem ipsum. 9 | -------------------------------------------------------------------------------- /tasks/bundler.rake: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | begin 4 | require 'bundler/gem_tasks' 5 | rescue LoadError 6 | raise 'Bundler is required to build this gem. 7 | Install Bundler using: gem install bundler 8 | Then, install required gems using: bundle --path=.bundle/gems' 9 | end 10 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | asciidoc: 4 | excerpt_doctype: inline 5 | asciidoctor: 6 | # base_dir is set to :docdir here to verify excerpt conversion doesn't break 7 | # we probably want to create a dedicated fixture for this scenario 8 | base_dir: :docdir 9 | -------------------------------------------------------------------------------- /spec/fixtures/pygments_code_highlighting/page-with-code.adoc: -------------------------------------------------------------------------------- 1 | = Code 2 | 3 | ```ruby 4 | class NilClass 5 | alias :nil_or_empty? :nil? 6 | end 7 | 8 | class String 9 | def nil_or_empty? 10 | alias :nil_or_empty? :empty? 11 | end 12 | end 13 | 14 | v = nil 15 | puts v.nil_or_empty? 16 | ``` 17 | -------------------------------------------------------------------------------- /spec/fixtures/safe_mode/_layouts/home.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/_layouts/custom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_layouts/custom.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_source/about/index.adoc: -------------------------------------------------------------------------------- 1 | = About Us 2 | 3 | We provide content design services for open source tech companies. 4 | 5 | * docfile={docfile} 6 | * docdir={docdir} 7 | * outfile={outfile} 8 | * outdir={outdir} 9 | * outpath={outpath} 10 | 11 | == Our Team 12 | 13 | include::about/_people.adoc[] 14 | -------------------------------------------------------------------------------- /spec/fixtures/with_custom_private_collection/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | 5 | 6 | Tips 7 | 8 | 9 | {% for tip in site.tips %} 10 |

{{ tip.title }}

11 |

Language: {{ tip.language }}

12 | {{ tip.content }} 13 | {% endfor %} 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/front_matter_defaults/_layouts/docs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/asciidocify_filter/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |

{{ page.summary | asciidocify: 'inline' }}

9 |
10 | {{ content }} 11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/front_matter_defaults/_layouts/general.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/site_wide_fallback_layout/_layouts/simple.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/with_custom_collection/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/fallback_to_default_layout/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_root/source/about/index.adoc: -------------------------------------------------------------------------------- 1 | = About Us 2 | 3 | We provide content design services for open source tech companies. 4 | 5 | * docfile={docfile} 6 | * docdir={docdir} 7 | * outfile={outfile} 8 | * outdir={outdir} 9 | * outpath={outpath} 10 | 11 | == Our Team 12 | 13 | include::source/about/_people.adoc[] 14 | -------------------------------------------------------------------------------- /spec/fixtures/site_wide_fallback_layout/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/with_custom_collection/_layouts/blueprint.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/tocify_filter/index.adoc: -------------------------------------------------------------------------------- 1 | = Page Title 2 | 3 | == Major Section A 4 | 5 | content 6 | 7 | === Minor Section A.1 8 | 9 | content 10 | 11 | == Major Section B 12 | 13 | content 14 | 15 | === Minor Section B.1 16 | 17 | content 18 | 19 | ==== Micro Section B.1.1 20 | 21 | content 22 | 23 | == Major Section C 24 | 25 | content 26 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_docdir/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ page.title }} 5 | 6 | 7 |
8 | {% if page.asciidocifyme %} 9 |

{{ page.asciidocifyme | asciidocify 'inline' }}

10 | {% endif %} 11 | {{ content }} 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/include_relative_to_docdir/about/index.adoc: -------------------------------------------------------------------------------- 1 | = About Us 2 | :page-asciidocifyme: *Who* we are. 3 | 4 | We provide content design services for open source tech companies. 5 | 6 | * docfile={docfile} 7 | * docdir={docdir} 8 | * outfile={outfile} 9 | * outdir={outdir} 10 | * outpath={outpath} 11 | 12 | == Our Team 13 | 14 | include::_people.adoc[] 15 | -------------------------------------------------------------------------------- /spec/fixtures/basic_site/_layouts/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {% if page.title %}{{ page.title }}{% else %}Site Title{% endif %} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /spec/fixtures/pygments_code_highlighting/_layouts/page.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 | 9 |
10 | {{ content }} 11 |
12 | 13 | 14 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/disabling-pub.adoc: -------------------------------------------------------------------------------- 1 | = Disabling Publishing of a Page 2 | 3 | To prevent a page from being published, set the page attribute named `page-published` to `false` (which, in turn, sets the page variable named `published` to `false`. 4 | 5 | [source,asciidoc] 6 | ---- 7 | = Top Secret Info 8 | :page-published: false 9 | 10 | This page should not be published. 11 | ---- 12 | 13 | -------------------------------------------------------------------------------- /spec/fixtures/tocify_filter/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 | {{ content }} 10 |
11 | {% if page.asciidoc %} 12 | 15 | {% endif %} 16 | 17 | 18 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc/mixins.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Jekyll 4 | module AsciiDoc 5 | Configured = ::Module.new 6 | Document = ::Module.new 7 | 8 | module Liquidable 9 | def to_liquid 10 | self 11 | end 12 | end 13 | 14 | module NoLiquid 15 | def render_with_liquid? 16 | false 17 | end 18 | end 19 | end 20 | end 21 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc/jekyll_ext/renderer/layouts.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Jekyll 4 | class Renderer 5 | # NOTE fixes "warning: instance variable @layouts not initialized" 6 | prepend (Module.new do 7 | def layouts 8 | @layouts = nil unless defined? @layouts 9 | super 10 | end 11 | end) 12 | end 13 | end if Jekyll::Renderer.method_defined? :layouts 14 | -------------------------------------------------------------------------------- /spec/fixtures/implicit_page_variables/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | {{ page.title }} 5 | 6 | 7 |
8 |

{{ page.surprising }} {{ page.un-expected }}{{ page.not-implicit }}{{ page.not_implicit }} {{ page.when }}

9 |
10 |
11 | {{ content }} 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc/jekyll_ext/site/find_generator_instance.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Jekyll 4 | class Site 5 | # Introduce complement to {::Jekyll::Site#find_converter_instance} for generators. 6 | def find_generator_instance type 7 | generators.find {|candidate| type === candidate } || (raise %(No Generators found for #{type})) 8 | end 9 | end 10 | end unless Jekyll::Site.method_defined? :find_generator_instance 11 | -------------------------------------------------------------------------------- /tasks/rubocop.rake: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | begin 4 | require 'rubocop/rake_task' 5 | RuboCop::RakeTask.new :lint do |t| 6 | t.patterns = Dir['lib/**/*.rb'] + %w(Rakefile Gemfile tasks/*.rake spec/**/*.rb) 7 | end 8 | rescue LoadError => e 9 | task :lint do 10 | raise 'Failed to load lint task. 11 | Install required gems using: bundle --path=.bundle/gems 12 | Then, invoke Rake using: bundle exec rake', cause: e 13 | end 14 | end 15 | -------------------------------------------------------------------------------- /spec/fixtures/docinfo_filter/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | {{ page.document | asciidoc_docinfo }} 7 | 8 | {{ page.document | asciidoc_docinfo: "header" }} 9 | 10 |
11 | {{ content }} 12 |
13 | {{ page.document | asciidoc_docinfo: "custom" }} 14 | 15 | {{ page.document | asciidoc_docinfo: "footer" }} 16 | 17 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/_layouts/post.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 |
10 |

{{ page.title }}

11 |
12 |
13 | {{ content }} 14 |
15 |
16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spec/fixtures/custom_excerpt_separator/_layouts/post.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 |
10 |

{{ page.title }}

11 |
12 |
13 | {{ content }} 14 |
15 |
16 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spec/fixtures/posts_with_excerpts/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | 5 | 6 | Post Excerpts 7 | 8 | 9 |
10 |

Posts

11 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /spec/fixtures/custom_excerpt_separator/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | 5 | 6 | Post Excerpts 7 | 8 | 9 |
10 |

Posts

11 | 19 |
20 | 21 | 22 | -------------------------------------------------------------------------------- /tasks/rspec.rake: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | begin 4 | require 'rspec/core/rake_task' 5 | RSpec::Core::RakeTask.new :spec do |t| 6 | t.verbose = true 7 | t.rspec_opts = [ 8 | $VERBOSE || ENV['COVERAGE'] ? '-w' : nil, 9 | ENV['CI'] && ENV['COVERAGE'] ? '-fd' : '-fp', 10 | ENV['GITHUB_RUN_ID'] ? %(--seed #{ENV['GITHUB_RUN_ID']}) : %(--seed #{Random.rand 1000}), 11 | ].compact.join ' ' 12 | end 13 | rescue LoadError 14 | warn $!.message 15 | end 16 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/glossary.adoc: -------------------------------------------------------------------------------- 1 | [glossary] 2 | = Glossary 3 | 4 | [glossary] 5 | page variable:: 6 | Data associated with a page, post or document. 7 | Page variables are defined in the front matter header or as page attributes in the AsciiDoc header. 8 | 9 | page attribute:: 10 | Any AsciiDoc attribute that gets promoted to a page variable by this plugin. 11 | Before being promoted, the designated prefix is removed from the name. 12 | The value of a page attribute is parse as YAML data. 13 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc/jekyll_ext/drops/drop.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Jekyll 4 | module Drops 5 | class Drop 6 | class << self 7 | # NOTE fixes "warning: instance variable @is_mutable not initialized" 8 | prepend (Module.new do 9 | def mutable? 10 | @is_mutable ||= nil # rubocop:disable Naming/MemoizedInstanceVariableName 11 | end 12 | end) 13 | end 14 | end 15 | end 16 | end if defined? Jekyll::Drops::Drop 17 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/index.html: -------------------------------------------------------------------------------- 1 | --- 2 | --- 3 | 4 | 5 | 6 | Posts 7 | 8 | 9 |
10 |

Posts

11 | 20 |
21 | 22 | 23 | -------------------------------------------------------------------------------- /spec/fixtures/merged_attributes/merge.adoc: -------------------------------------------------------------------------------- 1 | = Page with merged_attributes and overrides 2 | :page-attr: {one: one-value-override, \ 3 | two: { \ 4 | two-sub-one: \ 5 | [d, e], \ 6 | two-sub-two: \ 7 | { two-sub-two-sub-one: 221-value-override } \ 8 | } \ 9 | } 10 | :page-complex: {foo1: not bar!, \ 11 | foo2: { \ 12 | bar1: [z] \ 13 | }} 14 | :implicit1: {one: [c,d]} 15 | :implicit2: {one: [c,d]} 16 | :page-implicit2: {one: [e,f]} 17 | 18 | Ludicrous content! 19 | 20 | {page-attr} 21 | 22 | {page-complex} 23 | 24 | {implicit1} 25 | 26 | {implicit2} 27 | -------------------------------------------------------------------------------- /spec/fixtures/with_posts/_layouts/post.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 |
10 |

{{ page.title }}

11 |

12 | 13 |

14 |
15 |
16 | {{ content }} 17 |
18 |
19 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Jekyll 4 | module AsciiDoc 5 | jekyll_gem_version = ::Gem::Version.new ::Jekyll::VERSION 6 | Jekyll3_0 = (::Gem::Requirement.new '~> 3.0.0').satisfied_by? jekyll_gem_version 7 | Jekyll3_1 = !Jekyll3_0 && ((::Gem::Requirement.new '~> 3.1.0').satisfied_by? jekyll_gem_version) 8 | end 9 | end 10 | require_relative 'jekyll-asciidoc/jekyll_ext' 11 | require_relative 'jekyll-asciidoc/utils' 12 | require_relative 'jekyll-asciidoc/mixins' 13 | require_relative 'jekyll-asciidoc/excerpt' 14 | require_relative 'jekyll-asciidoc/converter' 15 | require_relative 'jekyll-asciidoc/integrator' 16 | require_relative 'jekyll-asciidoc/filters' 17 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/safe-mode.adoc: -------------------------------------------------------------------------------- 1 | = Running in Safe Mode 2 | 3 | If you want to use this plugin when running Jekyll in {url-jekyll-global-config}[safe mode], you must add the `jekyll-asciidoc` gem to the whitelist in your site's `_config.yml` file: 4 | 5 | [source,yaml] 6 | ---- 7 | whitelist: 8 | - jekyll-asciidoc 9 | ---- 10 | 11 | Safe mode is enabled either through the `--safe` flag: 12 | 13 | $ jekyll build --safe 14 | 15 | or the `safe` configuration option in your site's `_config.yml` file: 16 | 17 | [source,yaml] 18 | ---- 19 | safe: true 20 | ---- 21 | 22 | Note that Asciidoctor has an independent xref:asciidoctor:api:set-safe-mode.adoc[safe mode] that this plugin sets to 'safe' by default. 23 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/asciidoctor.adoc: -------------------------------------------------------------------------------- 1 | = Configuration under the `asciidoctor` key 2 | 3 | The configuration under the `asciidoctor` key is all supplied to Asciidoctor. 4 | Top-level keys set xref:asciidoctor:api:options.adoc[options]. 5 | 6 | In addition, xref:global-page-attributes.adoc[] can be set under the `asciidoctor` key. 7 | 8 | The `base_dir` option has special handling in relation to Jekyll as explained xref:base-dir.adoc[here]. 9 | 10 | The Asciidoctor `safe` option defaults to `safe` if not set. 11 | See xref:asciidoctor:api:set-safe-mode.adoc[here] for more information on the Asciidoctor safe option. 12 | Note that there is also a distinct Jekyll safe mode, dicussed xref:safe-mode.adoc[here]. 13 | 14 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/drafts.adoc: -------------------------------------------------------------------------------- 1 | = Publishing a Draft Post 2 | 3 | You can defer adding a date to a post until it's ready to publish by making it a draft. 4 | To make a draft post, just place it in the `_drafts` folder instead of the `_posts` folder. 5 | But don't include the date in the filename or AsciiDoc header. 6 | 7 | To include the drafts when building the site, pass the `--drafts` flag to the `jekyll` command: 8 | 9 | $ jekyll build --drafts 10 | 11 | The date of each draft post will be based on the file's last modification time. 12 | 13 | When you're ready to publish the post, move the file from the `_drafts` folder to the `_posts` folder and assign a date to it either by adding it to the filename or by defining the `revdate` attribute in the AsciiDoc header. 14 | 15 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/about.adoc: -------------------------------------------------------------------------------- 1 | = About the Project 2 | 3 | The Jekyll AsciiDoc plugin, a plugin for the static site generator {url-jekyll}[Jekyll], is a member project of the Asciidoctor organization. 4 | This plugin is developed and supported by volunteers in the Asciidoctor community. 5 | 6 | == Authors 7 | 8 | This plugin was created by Dan Allen and Paul Rayner and has received contributions from many other individuals in the Asciidoctor community. 9 | 10 | == Copyright and License 11 | 12 | Copyright (C) 2013-2021 Dan Allen, Paul Rayner, and the Asciidoctor Project. 13 | Free use of this software is granted under the terms of the https://opensource.org/licenses/MIT[MIT License]. 14 | See https://github.com/asciidoctor/jekyll-asciidoc/blob/master/LICENSE.adoc[LICENSE] for details. 15 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | source 'https://rubygems.org' 4 | 5 | gemspec 6 | 7 | gem 'asciidoctor', %(~> #{ENV['ASCIIDOCTOR_VERSION']}), require: false if ENV.key? 'ASCIIDOCTOR_VERSION' 8 | gem 'em-websocket', '0.5.2', platform: [:jruby], require: false 9 | gem 'jekyll', %(~> #{ENV['JEKYLL_VERSION']}), require: false if ENV.key? 'JEKYLL_VERSION' 10 | # NOTE Windows does not include zoneinfo files, so load tzinfo-data gem 11 | gem 'tzinfo-data', platform: [:x64_mingw, :mingw], require: false 12 | 13 | group :coverage do 14 | gem 'deep-cover-core', '~> 1.1.0', require: false 15 | gem 'simplecov', '~> 0.22.0', require: false 16 | end 17 | 18 | group :docs do 19 | gem 'yard', require: false 20 | end 21 | 22 | group :lint do 23 | gem 'rubocop', '~> 1.57.0', require: false 24 | gem 'rubocop-rake', '~> 0.6.0', require: false 25 | gem 'rubocop-rspec', '~> 2.25.0', require: false 26 | end 27 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/classifying.adoc: -------------------------------------------------------------------------------- 1 | = Classifying Your Post 2 | 3 | In Jekyll, you classify a post by assigning it to categories and/or tags. 4 | We recommend defining these with the Asciidoc page attributes `page-categories` and `page-tags`, but it is also possible to define them in the front matter with the Jekyll page variables `categories` and `tags`. 5 | 6 | The attribute value must be expressed using the inline Array syntax for YAML: a comma-separated list of items surrounded by square brackets. 7 | If you only have one item, you can omit the brackets. 8 | In this case, you can also drop the plural from the attribute name. 9 | 10 | [source,asciidoc] 11 | ---- 12 | = Introducing the Jekyll AsciiDoc Plugin 13 | Author Name 14 | :page-category: Tech 15 | :page-tags: [ruby, jekyll, asciidoctor, ssg] 16 | 17 | The Jekyll AsciiDoc plugin makes Jekyll awesome. 18 | Why? 19 | Because you can write posts like this one in AsciiDoc! 20 | ---- 21 | 22 | -------------------------------------------------------------------------------- /spec/fixtures/merged_attributes/_layouts/default.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | {{ page.title }} 6 | 7 | 8 |
9 |
10 |

{{ page.attr.one }}

11 |

{{ page.attr.two.two-sub-one[0]}}

12 |

{{ page.attr.two.two-sub-one[1]}}

13 |

{{ page.attr.two.two-sub-one[2]}}

14 |

{{ page.attr.two.two-sub-two.two-sub-two-sub-one}}

15 |

{{ page.attr.two.two-sub-two.two-sub-two-sub-two}}

16 |

{{ page.attr.two.two-sub-three.two-sub-three-sub-one}}

17 |

{{ page.attr.three }}

18 |

{{ page.complex }}

19 |

{{ page.implicit1 }}

20 |

{{ page.implicit2 }}

21 |
22 |
23 | {{ content }} 24 |
25 |
26 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/community.adoc: -------------------------------------------------------------------------------- 1 | = Getting Help 2 | 3 | The Jekyll AsciiDoc plugin is developed to help you publish your content quickly and easily. 4 | But we can't achieve that goal without your input. 5 | Your questions and feedback help steer the project, so speak up! 6 | Activity drives progress. 7 | 8 | When seeking answers, always start with the official documentation for Jekyll, which can be found on the {url-jekyll}[Jekyll website]. 9 | If you have general questions about Jekyll, we recommend you visit the {url-jekyll-discuss}[Jekyll Talk] forum to get assistance. 10 | For questions related to this extension specifically, or general questions about AsciiDoc, please post to the {url-asciidoctor-discuss}[Asciidoctor discussion list]. 11 | You can also join us in the {url-chat}[asciidoctor/asciidoctor channel] on Gitter. 12 | For general information about AsciiDoctor, look no further than the xref:asciidoctor::index.adoc[Asciidoctor User Manual]. 13 | 14 | -------------------------------------------------------------------------------- /spec/fixtures/merged_attributes/_config.yml: -------------------------------------------------------------------------------- 1 | plugins: 2 | - jekyll-asciidoc 3 | 4 | asciidoc: 5 | implicit_page_variables: 6 | - implicit1 7 | - implicit2 8 | 9 | asciidoctor: 10 | enable_attribute_value_coercion: true 11 | attributes: 12 | page-attr: 13 | one: one-value 14 | two: 15 | two-sub-one: 16 | - a 17 | - b 18 | - c 19 | two-sub-two: 20 | two-sub-two-sub-one: 221-value 21 | two-sub-two-sub-two: 222-value 22 | two-sub-three: 23 | two-sub-three-sub-one: 231-value 24 | three: three-value 25 | page-complex: 26 | foo1: bar 27 | foo2: 28 | bar1: 29 | - x 30 | - y 31 | bar2: baz 32 | implicit1: 33 | one: 34 | - a 35 | - b 36 | implicit2: 37 | one: 38 | - a 39 | - b 40 | merged_attributes: 41 | - page-attr 42 | - page-complex 43 | - implicit1 44 | - implicit2 45 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/index.adoc: -------------------------------------------------------------------------------- 1 | = Jekyll AsciiDoc Integration 2 | 3 | A plugin for {url-jekyll}[Jekyll] (>= 3.0.0) that converts {url-asciidoc}[AsciiDoc] source files in your site to HTML pages using {url-asciidoctor}[Asciidoctor]. 4 | 5 | == Overview 6 | 7 | The plugin consists of three extensions: 8 | 9 | Converter -- `Jekyll::AsciiDoc::Converter`:: 10 | Converts AsciiDoc files to HTML pages using Asciidoctor. 11 | 12 | Generator -- `Jekyll::AsciiDoc::Integrator`:: 13 | Promotes eligible AsciiDoc attributes (e.g., doctitle, id, author, and attributes that begin with the page attribute prefix) to Jekyll page variables. 14 | These attributes are merged with the page variables defined in the optional front matter header. 15 | 16 | Liquid Filters:: 17 | * `asciidocify` -- Uses the converter from this plugin to convert a string of AsciiDoc content to HTML. 18 | * `tocify_asciidoc` -- Generates a table of contents in HTML from the parsed AsciiDoc document of the current page (since 2.1.0). 19 | 20 | These extensions are registered automatically when the `jekyll-asciidoc` gem is required. 21 | 22 | -------------------------------------------------------------------------------- /docs/modules/ROOT/nav.adoc: -------------------------------------------------------------------------------- 1 | * xref:index.adoc[] 2 | * xref:installation.adoc[] 3 | * xref:pages.adoc[] 4 | ** xref:page-attributes.adoc[] 5 | ** xref:layout.adoc[] 6 | ** xref:disabling-pub.adoc[] 7 | ** xref:implicit-page-vars.adoc[] 8 | ** xref:doctitle.adoc[] 9 | * xref:blog.adoc[] 10 | ** xref:classifying.adoc[] 11 | ** xref:time.adoc[] 12 | ** xref:drafts.adoc[] 13 | * xref:liquid.adoc[] 14 | * xref:excerpts.adoc[] 15 | * xref:build.adoc[] 16 | * xref:configuration.adoc[] 17 | ** xref:asciidoc.adoc[] 18 | ** xref:asciidoctor.adoc[] 19 | ** xref:intrinsic-attributes.adoc[] 20 | ** xref:global-page-attributes.adoc[] 21 | ** xref:hard-line-breaks.adoc[] 22 | ** xref:base-dir.adoc[] 23 | //* xref:page-attributes.adoc[] 24 | * xref:liquid-attributes.adoc[] 25 | * xref:safe-mode.adoc[] 26 | * xref:liquid-filters.adoc[] 27 | * xref:templates.adoc[] 28 | * xref:extensions.adoc[] 29 | ** xref:asciidoctor-diagram.adoc[] 30 | * xref:stem.adoc[] 31 | * xref:supplemental-assets.adoc[] 32 | * xref:publishing.adoc[] 33 | * xref:community.adoc[] 34 | ** xref:issues.adoc[] 35 | * xref:development.adoc[] 36 | * xref:about.adoc[] 37 | 38 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2013-present Dan Allen, Paul Rayner, and the Asciidoctor Project 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/issues.adoc: -------------------------------------------------------------------------------- 1 | = Filing Bug Reports and Feature Requests 2 | 3 | This project uses the {url-issues}[GitHub issue tracker] to manage bug reports and feature requests. 4 | If you encounter a problem, please {url-search-issues}[browse or search] the issues to find out if your problem has already been reported. 5 | If it has not, you may {url-issues}/new[submit a new issue]. 6 | 7 | The best way to get a timely response and quick fix for your issue is to write a detailed report, preferably with a project or an RSpec test that reproduces the problem, and to respond to replies in a timely manner. 8 | 9 | If you know Ruby (or you're willing to learn), we encourage you to submit a pull request. 10 | Please include an RSpec behavior that describes how your feature should work or demonstrates the problem you're encountering. 11 | Make sure to send your pull request from a branch in your fork. 12 | If the pull request resolves an issue, please name the branch using the issue number (e.g., issue-N, where N is the issue number). 13 | 14 | If you aren't able to submit a pull request, please provide a sample so that the developers can reproduce your scenario. 15 | 16 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc/utils.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Jekyll 4 | module AsciiDoc 5 | module Utils 6 | MessageTopic = 'Jekyll AsciiDoc:' 7 | NewLine = ?\n 8 | 9 | module_function 10 | 11 | # Checks whether the file at the specified path has front matter. For AsciiDoc files, this method always returns 12 | # true. Otherwise, it delegates to {::Jekyll::Utils.has_yaml_header?}. 13 | # 14 | # @param dlg_method [Method] the delegate method to call if this path is not an AsciiDoc file. 15 | # @param asciidoc_ext_rx [Regexp] the regular expression to use to check if this path is an AsciiDoc file. 16 | # @param path [String] the path to check. 17 | # 18 | # @return [Boolean] whether the file at this path has front matter. 19 | def has_front_matter? dlg_method, asciidoc_ext_rx, path 20 | (asciidoc_ext_rx.match? ::File.extname path) || (dlg_method.call path) 21 | end 22 | 23 | # NOTE use define_method to match signature of original method (and avoid extra call) 24 | define_method :has_yaml_header?, &(::Jekyll::Utils.method :has_yaml_header?) 25 | end 26 | end 27 | end 28 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/hard-line-breaks.adoc: -------------------------------------------------------------------------------- 1 | = Enabling Hard Line Breaks Globally 2 | 3 | Many Jekyll users are used to writing in GitHub-flavored Markdown (GFM), which preserves hard line breaks in paragraph content. 4 | Asciidoctor supports this feature for AsciiDoc files. 5 | (In fact, previous versions of this plugin enabled this behavior by default). 6 | If you want to enable this behavior for AsciiDoc files, add the `hardbreaks` attribute to the Asciidoctor attributes configuration in your site's `_config.yml` file: 7 | 8 | [source,yaml] 9 | ---- 10 | asciidoctor: 11 | attributes: 12 | - hardbreaks 13 | ---- 14 | 15 | If you still want to allow individual files to be able to override the attribute, append the charcter `@` to the value in the site configuration: 16 | 17 | [source,yaml] 18 | ---- 19 | asciidoctor: 20 | attributes: 21 | - hardbreaks=@ 22 | ---- 23 | 24 | If you already have AsciiDoc attributes defined in the `_config.yml`, the new attribute should be added as a sibling entry in the YAML collection. 25 | 26 | WARNING: Keep in mind, if you enable hard line breaks, you won't be able to use the 'ventilated prose' or one-sentence-per-line writing technique. 27 | 28 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/time.adoc: -------------------------------------------------------------------------------- 1 | = Giving Your Post the Time of Day 2 | 3 | By default, all posts are assigned a date that is computed from the file name (e.g., the date for 2016-03-20-welcome.adoc is 2016-03-20). 4 | If you want to give your post a specific time as well, you can set the `revdate` attribute in the AsciiDoc header. 5 | 6 | We recommend using the format `YYYY-MM-DD HH:MM:SS Z` as shown in this example: 7 | 8 | [source,asciidoc] 9 | ---- 10 | = Post Title 11 | Author Name 12 | :revdate: 2016-03-20 10:30:00 -0600 13 | 14 | Lorem ipsum. 15 | ---- 16 | 17 | If you don't provide a time zone in the date, the date is assumed to be in the same time zone as the site (which is your local time zone by default). 18 | 19 | Alternatively, you can specify the date in the implicit xref:asciidoc:document:revision-line.adoc[revision line]. 20 | In this case, you must substitute the colons in the time part with "h", "m", and "s", respectively, since the colon demarcates the revision remark. 21 | 22 | [source,asciidoc] 23 | ---- 24 | = Post Title 25 | Author Name 26 | 2016-03-20 10h30m00s -0600 27 | 28 | Lorem ipsum. 29 | ---- 30 | 31 | Note that the revision line must be preceded by the implicit author line. 32 | 33 | -------------------------------------------------------------------------------- /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: Release 2 | run-name: ${{ github.workflow }} ${{ github.event.inputs.release-version }} 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | release-version: 7 | description: Enter version to release (e.g., 1.0.1). 8 | required: false 9 | jobs: 10 | perform: 11 | if: github.repository_owner == 'asciidoctor' && github.event_name == 'workflow_dispatch' 12 | runs-on: ubuntu-latest 13 | environment: releases 14 | steps: 15 | - name: Checkout 16 | uses: actions/checkout@v3 17 | - name: Install Ruby 18 | uses: ruby/setup-ruby@v1 19 | with: 20 | ruby-version: '3.2' 21 | bundler-cache: false 22 | - name: Configure Bundler 23 | run: | 24 | bundle config --local path vendor/bundle 25 | - name: Install dependencies 26 | run: bundle --jobs 3 --retry 3 27 | - name: Run linter 28 | run: bundle exec rake lint 29 | - name: Run tests 30 | run: bundle exec rake spec 31 | - name: Setup release environment 32 | run: | 33 | echo RELEASE_VERSION=${{ github.event.inputs.release-version }} >> $GITHUB_ENV 34 | echo RELEASE_RUBYGEMS_API_KEY=${{ secrets[format('RUBYGEMS_API_KEY_{0}', github.actor)] }} >> $GITHUB_ENV 35 | - name: Build, tag, and publish gem 36 | run: ./release.sh 37 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/asciidoc.adoc: -------------------------------------------------------------------------------- 1 | = Configuration under the `asciidoc` key 2 | 3 | [cols=3,opts=header] 4 | |=== 5 | | Key 6 | | Default value 7 | | Description 8 | 9 | | processor 10 | | asciidoctor 11 | | The AsciiDoc processor used by this plugin. 12 | Currently, `asciidoctor` is the only choice. 13 | 14 | | ext 15 | | asciidoc,adoc,ad 16 | | Non-hidden source files with these extensions will be processed by this plugin. 17 | 18 | | require_front_matter_header 19 | | false 20 | | By default, all non hidden files with the specified extensions will be processed by this plugin. 21 | Set to `true` for this plugin to only process files with a front matter header. 22 | 23 | | page_attribute_prefix 24 | | page 25 | | The prefix to recognize which Asciidoctor page attributes should be provided as Jekyll page variables. 26 | The Jekyll variable name is constructed by removing the `page-attribute-prefix` and following `-`. 27 | See xref:page-attributes.adoc[] for a more complete discussion. 28 | |=== 29 | 30 | In addition, xref:global-page-attributes.adoc[] can be set under the `asciidoc` key. 31 | 32 | As an example, a full configuration might look like this: 33 | 34 | [source,yaml] 35 | ---- 36 | asciidoc: 37 | processor: asciidoctor 38 | ext: adoc 39 | require_front_matter_header: true 40 | page_attribute_prefix: jekyll 41 | ---- 42 | 43 | 44 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/build.adoc: -------------------------------------------------------------------------------- 1 | = Building and Previewing Your Site 2 | 3 | You can build your site into the `_site' directory using: 4 | 5 | $ jekyll build 6 | 7 | If you're using Bundler, prefix each command with `bundle exec`: 8 | 9 | [source,subs=+quotes] 10 | $ *bundle exec* jekyll build 11 | 12 | You can preview your site at \http://localhost:4000 using: 13 | 14 | $ jekyll serve 15 | 16 | or 17 | 18 | [source,subs=+quotes] 19 | $ *bundle exec* jekyll serve 20 | 21 | The `serve` command monitors the file system and rebuilds the site whenever a change is detected by default (i.e., watch mode). 22 | To disable watch mode, use the `--no-watch` flag: 23 | 24 | $ jekyll serve --no-watch 25 | 26 | You can also use the `--watch` flag with the `build` command: 27 | 28 | $ jekyll build --watch 29 | 30 | If you only want Jekyll to build files which have changed, and not the whole site, add the `--incremental` flag: 31 | 32 | $ jekyll serve --incremental 33 | 34 | or 35 | 36 | $ jekyll build --watch --incremental 37 | 38 | To see a report of all the files that are processed, add the `--verbose` flag: 39 | 40 | $ jekyll build --verbose 41 | 42 | IMPORTANT: If you add the `--safe` flag, third-party plugins such as this one are disabled by default. 43 | To reenable the plugin, you must add the name of the gem to the whitelist. 44 | See xref:safe-mode.adoc[] for details. 45 | 46 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/base-dir.adoc: -------------------------------------------------------------------------------- 1 | = Specifying the Base Directory 2 | 3 | In Asciidoctor, the base directory (i.e., `base_dir` option) is used as the root when resolving relative include paths in top-level documents. 4 | 5 | By default, this plugin does not specify a base directory when invoking the Asciidoctor API. 6 | Asciidoctor will therefore use the current working directory (i.e., the project root) as the base directory. 7 | 8 | If your source directory is not the project root, and you want Asciidoctor to use the source directory as the base directory, set the value of the `base_dir` option to `:source`. 9 | 10 | [source,yaml] 11 | ---- 12 | asciidoctor: 13 | base_dir: :source 14 | ... 15 | ---- 16 | 17 | If, instead, you want the base directory to track the directory of the document being processed you can set the value of the `base_dir` option to `:docdir`. 18 | This behavior matches Asciidoctor behavior when converting single files from the command line outside of Jekyll. 19 | Since the base directory is also the jail, we also recommend setting the Asciidoctor `safe` option to enable unsafe mode so you can still resolve paths outside of this directory. 20 | 21 | [source,yaml] 22 | ---- 23 | asciidoctor: 24 | base_dir: :docdir 25 | safe: unsafe 26 | ... 27 | ---- 28 | 29 | You can also set the `base_dir` option to any relative or absolute path. 30 | In that case, the same value will be used for all documents. 31 | 32 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/doctitle.adoc: -------------------------------------------------------------------------------- 1 | = Showing the Document Title 2 | 3 | By default, when Asciidoctor converts your document, it does not include the document title in the body (aka `content`) part of the document that is passed to the layout. 4 | Instead, it skims off the document title and assigns it to the model as `page.title`. 5 | If you don't see the document title on the generated page at first, that's normal. 6 | 7 | There are two ways to have the document title included in the page: 8 | 9 | . Configure the layout to output the document title explicitly 10 | . Configure Asciidoctor to include the document title in the body 11 | 12 | The first option is the most typical. 13 | Somewhere in your layout, you should include the following statement: 14 | 15 | ---- 16 |

{{ page.title }}

17 | ---- 18 | 19 | This approach gives you the most control over how the document title appears and what HTML is used to enclose it. 20 | 21 | If, instead, you want the document title to be included in the body, add the following configuration to your site's `_config.yml` file: 22 | 23 | [source,yaml] 24 | ---- 25 | asciidoctor: 26 | attributes: 27 | showtitle@: true 28 | ---- 29 | 30 | It's also possible to enable or override this setting per page. 31 | 32 | [source,asciidoc] 33 | ---- 34 | = Page Title 35 | :showtitle: 36 | ---- 37 | 38 | Using either of these approaches, the document title will be shown on the generated page. 39 | 40 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/configuration.adoc: -------------------------------------------------------------------------------- 1 | = Configuration 2 | 3 | This section describes the configuration options for this plugin, which are _optional_. 4 | 5 | You should at least assign an empty Hash as a default (e.g., `{}`) to the `asciidoc` and `asciidoctor` keys in `_config.yml`, respectively, if you don't plan on making any further customizations. 6 | 7 | [source,yaml] 8 | ---- 9 | asciidoc: {} 10 | asciidoctor: {} 11 | ---- 12 | 13 | Using these placeholder values prevents initialization from being performed more than once when using watch mode (see https://github.com/jekyll/jekyll/issues/4858[issue jekyll#4858]). 14 | 15 | NOTE: This needs to be verified, as that issue is closed. 16 | 17 | == Configuration location 18 | 19 | There are two top level keys used for configuration of this plugin. 20 | 21 | `asciidoc`:: 22 | The `asciidoc` key is used for configuration of the general relationship of Jekyll to this plugin, including the singular choice of Asciidoctor as the AsciiDoc processor. 23 | `asciidoctor`:: 24 | The `asciidoctor` key is used for configuration of the Asciidoctor instance set up by this plugin. 25 | 26 | In addition, xref:global-page-attributes.adoc[] can be set under either the `asciidoc` key or the `asciidoctor` key. 27 | Through the xref:page-attributes.adoc[page attribute to page variable translation] this may result in global configuration of Jekyll page variables . 28 | 29 | As with any YAML, these keys should appear at most once in your `_config.yml` file. 30 | 31 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/layout.adoc: -------------------------------------------------------------------------------- 1 | = Specifying a Layout 2 | 3 | The most commonly defined page variable is `layout` (`page-layout` as an Asciidoc document attribute), which determines which template is used to wrap the generated content. 4 | Consult the {url-jekyll-layouts}[Jekyll layout documentation] for details. 5 | We will assume the default template location of `_layouts`. 6 | Jekyll will look for a template file inside the `_layouts` folder whose root name matches the name of the layout. 7 | For example, if the layout variable has the value `info`, Jekyll looks for a layout template at the path `_layouts/info.html`. 8 | 9 | Here are the different ways to specify a layout using the AsciiDoc attribute page-layout: 10 | 11 | `:page-layout: info`:: 12 | Use the layout named `info` (e.g., `_layout/info.html`) 13 | (unspecified):: 14 | `:page-layout:`:: 15 | `:page-layout: _auto`:: 16 | Use the automatic layout: 17 | * `page` for pages, 18 | * `post` for posts 19 | * The singular form of the {url-jekyll-collections}[collection label] for a document. 20 | For instance, if a collection `oddities` is defined in `_config.yml`, a document at `_oddities/my-oddity.adoc` will have the `odditie` layout applied. 21 | * If the auto-selected layout isn't available, the layout `default` is used 22 | `:!page-layout:`:: 23 | `:page-layout: false`:: 24 | Don't use a layout; instead, generate a standalone HTML document using only Asciidoctor's capabilities. 25 | `:page-layout: none`:: 26 | `:page-layout: ~` (deprecated):: 27 | Don't use a layout and produce embeddable HTML. 28 | 29 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/intrinsic-attributes.adoc: -------------------------------------------------------------------------------- 1 | = Asciidoctor intrinsic attributes 2 | 3 | In addition to the built-in attributes in AsciiDoc, the following additional AsciiDoc attributes are automatically defined by this plugin and available to all AsciiDoc-based pages: 4 | 5 | == Global attributes 6 | 7 | [cols=2*,opts=header] 8 | |=== 9 | | Attribute 10 | | Value 11 | 12 | | `site-root` 13 | | absolute path of root directory 14 | 15 | | `site-source` 16 | | absolute path of source directory 17 | 18 | | `site-destination` 19 | | absolute path of output directory 20 | 21 | |`site-baseurl` 22 | | value of the baseurl config option 23 | 24 | | `site-url` 25 | | value of the url config option 26 | 27 | | `env` 28 | | `site` 29 | 30 | | `env-site` 31 | | (set) 32 | 33 | | `site-gen` 34 | | `jekyll` 35 | 36 | | `site-gen-jekyll` 37 | | (set) 38 | 39 | | `builder` 40 | | `jekyll` 41 | 42 | | `builder-jekyll` 43 | | (set) 44 | 45 | | `jekyll-version` 46 | | value of the Jekyll::VERSION constant 47 | 48 | | `idprefix` 49 | | (empty string) 50 | 51 | | `idseparator` 52 | | `-` 53 | 54 | | `linkattrs` 55 | | `@` 56 | |=== 57 | 58 | == Per-page attributes 59 | 60 | [cols=2*,opts=header] 61 | |=== 62 | | Attribute 63 | | Value 64 | 65 | | `outpath` 66 | | path of page relative to baseurl 67 | |=== 68 | 69 | == Jekyll configuration promoted to AsciiDoc page attributes: 70 | 71 | [cols=4*,opts=header] 72 | |=== 73 | | Jekyll key 74 | | Value 75 | | AsciiDoc page attribute 76 | | Value 77 | 78 | | `unpublished` 79 | | (set) 80 | | `page-published` 81 | | `true` 82 | |=== 83 | 84 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/liquid-attributes.adoc: -------------------------------------------------------------------------------- 1 | = Using AsciiDoc attributes in a Liquid template 2 | 3 | Let's say you want to reuse your global AsciiDoc attributes in a Liquid template. 4 | This section describes how to do it. 5 | 6 | Liquid can only access simple data structures, not complex ones like the one used to store site-wide AsciiDoc attributes. (Site-wide AsciiDoc attributes are stored deep within the Jekyll configuration data as a Hash with symbol keys). 7 | This puts them out of the reach of Liquid templates by default. 8 | 9 | This plugin must store site-wide AsciiDoc attributes in this way due to how Jekyll is implemented and the lifecycle it exposes for plugins. 10 | That part can't be changed. 11 | The plugin is limited by Jekyll's design. 12 | However, YAML provides a mechanism that we can leverage to expose these attributes to our Liquid templates. 13 | 14 | First, you define your AsciiDoc attributes at the top level of your configuration file where Liquid is able to access them. 15 | If you also assign a YAML reference to this key, you can then pass that Hash to the attributes key in the asciidoctor block, thus allowing the configuration to be shared. 16 | 17 | [source,yaml] 18 | ---- 19 | asciidoc_attributes: &asciidoc_attributes 20 | imagesdir=/images 21 | asciidoctor: 22 | attributes: *asciidoc_attributes 23 | ... 24 | ---- 25 | 26 | You can now reference one of the site-wide AsciiDoc attributes in the Liquid template as follows: 27 | 28 | ---- 29 | {{ site.asciidoc_attributes.imagesdir }} 30 | ---- 31 | 32 | Keep in mind that the value of the attribute will be unmodified from the value defined in the configuration file. 33 | 34 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc/excerpt.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Jekyll 4 | module AsciiDoc 5 | class Excerpt < ::Jekyll::Excerpt 6 | if Jekyll3_0 7 | def_delegators :@doc, :destination, :url 8 | else 9 | def_delegators :@doc, :destination 10 | end 11 | 12 | def initialize primary_doc, excerpt_content 13 | excerpt_doc = primary_doc.dup 14 | excerpt_doc.content = excerpt_content 15 | excerpt_doc.extend NoLiquid unless primary_doc.data['liquid'] 16 | super excerpt_doc 17 | end 18 | 19 | def extract_excerpt content 20 | # NOTE excerpt_doctype has already been resolved from either the page attribute or front matter variable 21 | if (doctype = (excerpt_data = data)['excerpt_doctype'] || 22 | (inherited = doc.site.config['asciidoc']['excerpt_doctype'])) 23 | excerpt_data['doctype'] = doctype 24 | excerpt_data['excerpt_doctype'] = doc.data['excerpt_doctype'] = doctype if inherited 25 | end 26 | content 27 | end 28 | 29 | def output 30 | unless defined? @output 31 | renderer = ::Jekyll::Renderer.new doc.site, self, site.site_payload 32 | @output = renderer.run 33 | trigger_hooks :post_render 34 | end 35 | @output 36 | end 37 | 38 | def render_with_liquid? 39 | !(NoLiquid === doc) 40 | end 41 | 42 | # NOTE Jekyll 3.0 incorrectly maps to_liquid to primary doc 43 | alias to_liquid data if Jekyll3_0 44 | 45 | def trigger_hooks hook_name, *args 46 | ::Jekyll::Hooks.trigger :excerpts, hook_name, self, *args 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/liquid.adoc: -------------------------------------------------------------------------------- 1 | = Enabling Liquid Preprocessing 2 | 3 | Unlike other content files, the {url-jekyll-liquid-templates}[Liquid template preprocessor] is not applied to AsciiDoc files by default. 4 | If you want the Liquid template preprocessor to be applied to an AsciiDoc file (prior to the content being passed to the AsciiDoc processor), you must enable it by setting the `liquid` page variable, shown here defined using a page attribute. 5 | 6 | [source,asciidoc] 7 | ---- 8 | :page-liquid: 9 | ---- 10 | 11 | It is also possible to set the `page-liquid` asciidoc attribute globally in `_config.yml` or to set the `liquid` page variable directly in Jekyll front matter. 12 | 13 | == Asciidoc Inclusions 14 | 15 | The Liquid preprocessor does not process content included using the AsciiDoc include directive (see {url-issues}/166[#166]). 16 | 17 | However, if those files are otherwise publishable, they are processed independently with the Liquid preprocessor and will appear in your site. 18 | If this is not desired, exclude them from independent processing by one of: 19 | 20 | * Placing them in an automatically excluded location, such as a directory starting with `_`, e.g. `_includes`. 21 | * Naming them so as to be automatically excluded, such as starting the name with `_`, e.g. `_excluded-include.yml`. 22 | * Configuring the link:https://jekyllrb.com/docs/configuration/options/[Jekyll excludes] so as to apply to the file. 23 | 24 | == Liquid Inclusions 25 | 26 | If you're using the Liquid include tag to include HTML into the AsciiDoc document, enclose it in a passthrough block. 27 | 28 | ---- 29 | ++++ 30 | {% include file.html %} 31 | ++++ 32 | ---- 33 | 34 | Otherwise Asciidoctor will escape the HTML. 35 | 36 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/excerpts.adoc: -------------------------------------------------------------------------------- 1 | = Extracting Excerpts 2 | 3 | Unless the `page-excerpt` page attribute or the `excerpt` page variable is set, this plugin will extract an {url-jekyll-excerpts}[excerpt] for any post or document in a collection using the same logic as for Markdown files. 4 | By default, it will use the content between the header (if present) or front matter (if present) and the next blank line. 5 | If the `page-excerpt` page attribute or the `excerpt` page variable is set, that value will be used instead. 6 | The excerpt will automatically be converted from AsciiDoc to embedded HTML whereever the `excerpt` property is referenced in a Liquid template. 7 | 8 | ---- 9 | {% post.excerpt %} 10 | ---- 11 | 12 | If you want to use a different excerpt separator for AsciiDoc files, set the `excerpt_separator` under the `asciidoc` key in the site configuration. 13 | For example, you can configure the plugin to use the line comment `//more` as the excerpt separator as follows: 14 | 15 | [source,yaml] 16 | ---- 17 | asciidoc: 18 | excerpt_separator: "\n//more\n" 19 | ---- 20 | 21 | If you're only working with AsciiDoc files in your site, you can go ahead and set this for all files by using the top-level property: 22 | 23 | [source,yaml] 24 | ---- 25 | excerpt_separator: "\n//more\n" 26 | ---- 27 | 28 | If the excerpt separator isn't found, the content of the whole document is used instead. 29 | 30 | By default, the excerpt is converted to HTML using the article doctype. 31 | If you want to use a different doctype, such as inline, you can set it in the site configuration as follows: 32 | 33 | [source,yaml] 34 | ---- 35 | asciidoc: 36 | excerpt_doctype: inline 37 | ---- 38 | 39 | You can also set the excerpt doctype per page using the page attribute named `page-excerpt_doctype`. 40 | -------------------------------------------------------------------------------- /docs/antora.yml: -------------------------------------------------------------------------------- 1 | name: jekyll-integration 2 | title: Jekyll Integration 3 | version: 3.1 4 | prerelease: -alpha.1 5 | nav: 6 | - modules/ROOT/nav.adoc 7 | 8 | asciidoc: 9 | attributes: 10 | url-repo: https://github.com/asciidoctor/jekyll-asciidoc 11 | url-issues: https://github.com/asciidoctor/jekyll-asciidoc/issues 12 | url-search-issues: https://github.com/asciidoctor/jekyll-asciidoc/search\?type=Issues 13 | url-chat: https://gitter.im/asciidoctor/asciidoctor 14 | url-ci-travis: https://travis-ci.org/asciidoctor/jekyll-asciidoc 15 | url-ci-appveyor: https://ci.appveyor.com/project/asciidoctor/jekyll-asciidoc 16 | url-gem: http://rubygems.org/gems/jekyll-asciidoc 17 | url-gem-asciidoctor: http://rubygems.org/gems/asciidoctor 18 | url-asciidoc: http://asciidoc.org 19 | url-asciidoctor: http://asciidoctor.org 20 | url-asciidoctor-backends: https://github.com/asciidoctor/asciidoctor-backends 21 | url-asciidoctor-discuss: http://discuss.asciidoctor.org 22 | url-jaq: https://github.com/asciidoctor/jekyll-asciidoc-quickstart 23 | url-jekyll: https://jekyllrb.com 24 | url-jekyll-discuss: https://talk.jekyllrb.com 25 | url-jekyll-docs: https://jekyllrb.com/docs 26 | url-jekyll-collections: https://jekyllrb.com/docs/collections 27 | url-jekyll-excerpts: https://jekyllrb.com/docs/posts/#post-excerpts 28 | url-jekyll-front-matter: https://jekyllrb.com/docs/frontmatter 29 | url-jekyll-layouts: https://jekyllrb.com/docs/layouts 30 | url-jekyll-liquid-templates: https://jekyllrb.com/docs/templates 31 | url-jekyll-global-config: https://jekyllrb.com/docs/configuration/options/#global-configuration 32 | url-jekyll-variables: https://jekyllrb.com/docs/variables 33 | url-graphviz: http://www.graphviz.org 34 | url-tilt: https://github.com/rtomayko/tilt 35 | url-yaml: https://en.wikipedia.org/wiki/YAML 36 | url-guide-publish-gem: http://guides.rubygems.org/publishing/#publishing-to-rubygemsorg 37 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/pages.adoc: -------------------------------------------------------------------------------- 1 | = Creating Pages 2 | 3 | This plugin converts eligible AsciiDoc files located inside the source directory (by default, the project root) to HTML pages in the generated site. 4 | There are a few conditions that must be met in order for an AsciiDoc file to be eligible: 5 | 6 | . The file must have an AsciiDoc file extension (see xref:configuration.adoc[]). 7 | . The name of the file must not begin with a dot (`.`) or an underscore (`_`).footnote:excluded_files[Hidden files and folders are automatically excluded by Jekyll.] 8 | . The file must not be located in a folder whose name begins with a dot (`.`) or an underscore (`_`) (unless the folder is a designated collection, such as _posts).footnote:excluded_files[] 9 | 10 | Here's a sample AsciiDoc file that meets these criteria: 11 | 12 | .sample.adoc 13 | [source,asciidoc] 14 | ---- 15 | = Sample Page 16 | :page-layout: info 17 | :page-permalink: /sample/ 18 | :url-asciidoctor: http://asciidoctor.org 19 | 20 | This is a sample page composed in AsciiDoc. 21 | Jekyll converts it to HTML using {url-asciidoctor}[Asciidoctor]. 22 | It is presented in the `{page-layout}` layout. 23 | 24 | [source,ruby] 25 | puts "Hello, World!" 26 | ---- 27 | We recommend defining Jekyll page variables as xref:page-attributes.adoc[]. 28 | However, it is also possible to define them in traditional Jekyll front matter. 29 | In this case the variables will not be available as Asciidoc attributes: 30 | 31 | .sample.adoc 32 | [source,asciidoc] 33 | ---- 34 | --- 35 | layout: info 36 | permalink: /sample/ 37 | --- 38 | = Sample Page 39 | :url-asciidoctor: http://asciidoctor.org 40 | 41 | This is a sample page composed in AsciiDoc. 42 | Jekyll converts it to HTML using {url-asciidoctor}[Asciidoctor]. 43 | //It is presented in the `{page-layout}` layout. <1> 44 | 45 | [source,ruby] 46 | puts "Hello, World!" 47 | ---- 48 | <1> Since the layout is defined in the front matter, it is not available as an Asciidoc attribute. -------------------------------------------------------------------------------- /release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # required packages (for ubuntu:kinetic): curl git jq ruby 4 | 5 | if [ -z "$RELEASE_RUBYGEMS_API_KEY" ]; then 6 | echo No API key specified for publishing to rubygems.org. Stopping release. 7 | exit 1 8 | fi 9 | export RELEASE_BRANCH=${GITHUB_REF_NAME:-main} 10 | if [ ! -v RELEASE_USER ]; then 11 | export RELEASE_USER=$GITHUB_ACTOR 12 | fi 13 | RELEASE_GIT_NAME=$(curl -s https://api.github.com/users/$RELEASE_USER | jq -r .name) 14 | RELEASE_GIT_EMAIL=$RELEASE_USER@users.noreply.github.com 15 | GEMSPEC=$(ls -1 *.gemspec | head -1) 16 | RELEASE_GEM_NAME=$(ruby -e "print (Gem::Specification.load '$GEMSPEC').name") 17 | # RELEASE_VERSION must be an exact version number; if not set, defaults to next patch release 18 | if [ -z "$RELEASE_VERSION" ]; then 19 | export RELEASE_VERSION=$(ruby -e "print (Gem::Specification.load '$GEMSPEC').version.then { _1.prerelease? ? _1.release.to_s : (_1.segments.tap {|s| s[-1] += 1 }.join ?.) }") 20 | fi 21 | export RELEASE_GEM_VERSION=${RELEASE_VERSION/-/.} 22 | 23 | # configure git to push changes 24 | git config --local user.name "$RELEASE_GIT_NAME" 25 | git config --local user.email "$RELEASE_GIT_EMAIL" 26 | 27 | # configure gem command for publishing 28 | mkdir -p $HOME/.gem 29 | echo -e "---\n:rubygems_api_key: $RELEASE_RUBYGEMS_API_KEY" > $HOME/.gem/credentials 30 | chmod 600 $HOME/.gem/credentials 31 | 32 | # release! 33 | ( 34 | set -e 35 | ruby tasks/version.rb 36 | git commit -a -m "release $RELEASE_VERSION [no ci]" 37 | git tag -m "version $RELEASE_VERSION" v$RELEASE_VERSION 38 | mkdir -p pkg 39 | gem build $GEMSPEC -o pkg/$RELEASE_GEM_NAME-$RELEASE_GEM_VERSION.gem 40 | git push origin $(git describe --tags --exact-match) 41 | gem push pkg/$RELEASE_GEM_NAME-$RELEASE_GEM_VERSION.gem 42 | git push origin $RELEASE_BRANCH 43 | ) 44 | 45 | exit_code=$? 46 | 47 | # nuke gem credentials 48 | rm -rf $HOME/.gem 49 | 50 | # check for any uncommitted files 51 | git status -s -b 52 | 53 | exit $exit_code 54 | -------------------------------------------------------------------------------- /tasks/version.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | require 'time' 4 | 5 | release_version = ENV['RELEASE_VERSION'] 6 | release_date = Time.now.strftime '%Y-%m-%d' 7 | release_user = ENV['RELEASE_USER'] 8 | 9 | version_file = Dir['lib/**/version.rb'].first 10 | version_contents = (File.readlines version_file, mode: 'r:UTF-8').map do |l| 11 | (l.include? 'VERSION') ? (l.sub %r/'[^']+'/, %('#{release_version}')) : l 12 | end 13 | 14 | readme_file = 'README.adoc' 15 | readme_contents = File.readlines readme_file, mode: 'r:UTF-8' 16 | if readme_contents[2].start_with? 'v' 17 | readme_contents[2] = %(v#{release_version}, #{release_date}\n) 18 | else 19 | readme_contents.insert 2, %(v#{release_version}, #{release_date}\n) 20 | end 21 | 22 | changelog_file = 'CHANGELOG.adoc' 23 | changelog_contents = File.readlines changelog_file, mode: 'r:UTF-8' 24 | if (last_release_idx = changelog_contents.index {|l| (l.start_with? '== ') && (%r/^== \d/.match? l) }) 25 | previous_release_version = (changelog_contents[last_release_idx].match %r/\d\S+/)[0] 26 | else 27 | changelog_contents << %(#{changelog_contents.pop.chomp}\n) 28 | changelog_contents << ?\n 29 | last_release_idx = changelog_contents.length 30 | end 31 | changelog_contents.insert last_release_idx, <<~END 32 | === Details 33 | 34 | {url-repo}/releases/tag/v#{release_version}[git tag]#{previous_release_version ? %( | {url-repo}/compare/v#{previous_release_version}\\...v#{release_version}[full diff]\n) : ''} 35 | END 36 | if (unreleased_idx = changelog_contents.index {|l| (l.start_with? '== Unreleased') && l.rstrip == '== Unreleased' }) 37 | changelog_contents[unreleased_idx] = %(== #{release_version} (#{release_date}) - @#{release_user}\n) 38 | else 39 | changelog_contents.insert last_release_idx, <<~END 40 | == #{release_version} (#{release_date}) - @#{release_user} 41 | 42 | _No changes since previous release._ 43 | 44 | END 45 | end 46 | 47 | File.write version_file, version_contents.join, mode: 'w:UTF-8' 48 | File.write readme_file, readme_contents.join, mode: 'w:UTF-8' 49 | File.write changelog_file, changelog_contents.join, mode: 'w:UTF-8' 50 | -------------------------------------------------------------------------------- /jekyll-asciidoc.gemspec: -------------------------------------------------------------------------------- 1 | require File.absolute_path 'lib/jekyll-asciidoc/version', __dir__ 2 | require 'open3' unless defined? Open3 3 | 4 | Gem::Specification.new do |s| 5 | s.name = 'jekyll-asciidoc' 6 | s.version = Jekyll::AsciiDoc::VERSION 7 | s.summary = 'A Jekyll plugin that converts the AsciiDoc source files in your site to HTML pages using Asciidoctor.' 8 | s.description = s.summary 9 | 10 | s.authors = ['Dan Allen', 'Paul Rayner'] 11 | s.email = ['dan.j.allen@gmail.com'] 12 | s.homepage = 'https://github.com/asciidoctor/jekyll-asciidoc' 13 | s.license = 'MIT' 14 | s.metadata = { 15 | 'bug_tracker_uri' => 'https://github.com/asciidoctor/jekyll-asciidoc/issues', 16 | 'changelog_uri' => 'https://github.com/asciidoctor/jekyll-asciidoc/blob/master/CHANGELOG.adoc', 17 | 'mailing_list_uri' => 'http://discuss.asciidoctor.org', 18 | 'source_code_uri' => 'https://github.com/asciidoctor/jekyll-asciidoc', 19 | } 20 | # NOTE the required ruby version is informational only 21 | # it tracks the minimum version required by Jekyll >= 3.0.0 (see https://jekyllrb.com/docs/installation/#requirements) 22 | # we don't enforce it because it can't be overridden and can cause builds to break 23 | #s.required_ruby_version = '>= 2.2.0' 24 | 25 | files = begin 26 | (result = Open3.popen3('git ls-files -z') {|_, out| out.read }.split ?\0).empty? ? Dir['**/*'] : result 27 | rescue ::SystemCallError 28 | Dir['**/*'] 29 | end 30 | s.files = files.grep %r/^(?:lib\/.+|Gemfile|LICENSE|(?:CHANGELOG|README)\.adoc|\.yardopts|jekyll-asciidoc\.gemspec)$/ 31 | #s.test_files = files.grep %r/^spec\/./ 32 | 33 | s.require_paths = ['lib'] 34 | 35 | s.add_runtime_dependency 'asciidoctor', '~> 2.0' 36 | s.add_runtime_dependency 'jekyll', '>= 3.0.0' 37 | 38 | s.add_development_dependency 'jekyll-mentions', '~> 1.6.0' 39 | s.add_development_dependency 'kramdown-parser-gfm', '~> 1.1.0' # required when testing Jekyll 3 40 | s.add_development_dependency 'pygments.rb', '~> 2.4.0' 41 | s.add_development_dependency 'rake', '~> 13.1.0' 42 | s.add_development_dependency 'rspec', '~> 3.12.0' 43 | end 44 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: ['**'] 5 | paths-ignore: ['*.adoc', 'docs/**'] 6 | pull_request: 7 | paths-ignore: ['*.adoc', 'docs/**'] 8 | #schedule: 9 | #- cron: '30 2 * * MON' 10 | concurrency: 11 | group: ${{ github.workflow }}-${{ github.ref }} 12 | cancel-in-progress: true 13 | jobs: 14 | build: 15 | strategy: 16 | matrix: 17 | os: [ubuntu-latest] 18 | ruby: ['2.7', '3.2'] 19 | jekyll-version: [~] 20 | exclude: 21 | # remove entry to mark as primary 22 | - os: ubuntu-latest 23 | ruby: '3.2' 24 | include: 25 | - os: ubuntu-latest 26 | ruby: jruby-9.4 27 | - os: windows-latest 28 | ruby: '3.2' 29 | - os: ubuntu-latest 30 | ruby: '3.2' 31 | jekyll-version: '3.9.0' 32 | - os: ubuntu-latest 33 | ruby: '3.2' 34 | primary: primary 35 | runs-on: ${{ matrix.os }} 36 | env: 37 | BUNDLE_WITHOUT: coverage:docs:lint 38 | SOURCE_DATE_EPOCH: '1521504000' 39 | steps: 40 | - name: Checkout 41 | uses: actions/checkout@v3 42 | - name: Set Jekyll version 43 | if: matrix.jekyll-version 44 | run: echo 'JEKYLL_VERSION=${{ matrix.jekyll-version }}' >> $GITHUB_ENV 45 | - name: Enable lint and coverage (primary only) 46 | if: matrix.primary 47 | run: | 48 | echo 'BUNDLE_WITHOUT=docs' >> $GITHUB_ENV 49 | echo 'COVERAGE=deep' >> $GITHUB_ENV 50 | - name: Install Ruby (uses cached dependencies for non-scheduled build) 51 | uses: ruby/setup-ruby@v1 52 | with: 53 | ruby-version: ${{ matrix.ruby }} 54 | bundler-cache: ${{ github.event_name != 'schedule' }} 55 | - name: Install dependencies (scheduled build only) 56 | if: github.event_name == 'schedule' 57 | run: | 58 | bundle config --local path vendor/bundle 59 | bundle --jobs 3 --retry 3 60 | - name: Run linter (primary only) 61 | if: matrix.primary 62 | run: bundle exec rake lint 63 | - name: Run tests 64 | run: bundle exec ruby -w $(bundle exec ruby -e 'print File.join Gem.bindir, %q(rake)') spec 65 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/stem.adoc: -------------------------------------------------------------------------------- 1 | = Enabling STEM Support 2 | 3 | Thanks to Asciidoctor, Jekyll AsciiDoc provides built-in support for processing STEM (Science, Technology, Engineering & Math) equations in your AsciiDoc documents. 4 | To enable this support, you just need to do a bit of configuration. 5 | 6 | == Activating the STEM processing 7 | 8 | The first thing you need to do is activate the STEM processing integration in the processor itself. 9 | To do that, set the `stem` attribute on the document. 10 | One way is to set the `stem` attribute in the document header: 11 | 12 | [source,asciidoc] 13 | ---- 14 | = Page Title 15 | :stem: 16 | ---- 17 | 18 | Alternatively, you can enable it the `stem` attribute globally for all AsciiDoc documents in your site by adding the following to your site's `_config.yml` file: 19 | 20 | [source,yaml] 21 | ---- 22 | asciidoctor: 23 | attributes: 24 | - stem 25 | ---- 26 | 27 | To learn more about the built-in STEM integration, see the xref:asciidoctor:stem:index.adoc[]. 28 | 29 | == Adding the STEM assets to the page 30 | 31 | Technically, Asciidoctor only prepares the STEM equations for interpretation by https://mathjax.org[MathJax]. 32 | That means you have to load MathJax on any page that contains STEM equations (or all pages, if that's easier). 33 | To do so requires some customization of the page layout. 34 | 35 | First, create the file `_includes/mathjax.html` and populate it with the following contents: 36 | 37 | [source,html] 38 | ---- 39 | 54 | 55 | ---- 56 | 57 | Then, include this file before the closing `` tag in your page layout. 58 | 59 | ---- 60 | {% include mathjax.html %} 61 | ---- 62 | 63 | With that configuration in place, the STEM equations in your AsciiDoc file will be presented beautifully using MathJax. 64 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/extensions.adoc: -------------------------------------------------------------------------------- 1 | = Enabling Asciidoctor Extensions 2 | 3 | You enable Asciidoctor extensions in much the same way as this plugin. 4 | You just need to configure Jekyll to load the source. 5 | 6 | This process works for self-registering Asciidoctor extensions. 7 | If you are using a published extension that is not self-registering, you will need to add registration code as an <>. 8 | 9 | == Extensions published as Gems 10 | 11 | If the extension you want to use is published as a gem, and you're using Bundler to manage the dependencies for your project (as recommended), then you simply add the gem to the `jekyll_plugins` group in your `Gemfile`: 12 | 13 | [source,ruby] 14 | ---- 15 | group :jekyll_plugins do 16 | gem 'asciidoctor-extension-xyz' 17 | end 18 | ---- 19 | 20 | Then, run the `bundle` command from Bundler to install the gem: 21 | 22 | $ bundle 23 | 24 | If you're not using Bundler to manage the dependencies for your Jekyll project, you'll need to install the gem manually. 25 | Once that's done, add the gem to the list gems for Jekyll to load in your site's `_config.yml` file: 26 | 27 | [source,ruby] 28 | ---- 29 | plugins: 30 | - asciidoctor-extension-xyz 31 | ---- 32 | 33 | If you're running Jekyll < 3.5.0, you'll need to use `gems` in place of `plugins`: 34 | 35 | [source,ruby] 36 | ---- 37 | gems: 38 | - asciidoctor-extension-xyz 39 | ---- 40 | 41 | == Unpublished extensions 42 | 43 | If the extension you want to use is not published as a gem, or is something you're developing, then you'll load it like an ad-hoc Jekyll plugin. 44 | Add the file `asciidoctor-extensions.rb` to the `_plugins` folder of your project root (creating the folder if it does not already exist) and populate the file with the extension registration and implementation code, such as: 45 | 46 | ._plugins/asciidoctor-extensions.rb 47 | [source,ruby] 48 | ---- 49 | require 'asciidoctor/extensions' 50 | 51 | Asciidoctor::Extensions.register do 52 | # registration code 53 | treeprocessor do 54 | # processor implementation 55 | process do |doc| 56 | doc 57 | end 58 | end 59 | end 60 | ---- 61 | 62 | Asciidoctor will automatically enable the extensions in this file when it is loaded by Jekyll. 63 | 64 | For a concrete example of using an existing, published, Asciidoctor extension, refer to the next section. 65 | 66 | -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/implicit-page-vars.adoc: -------------------------------------------------------------------------------- 1 | = Implicit Page Variables 2 | 3 | == Built-in implicit page variables 4 | 5 | In addition to page attributes defined explicitly (e.g., `page-layout`, `page-permalink`, etc), the following implicit AsciiDoc attributes are also promoted to page variables: 6 | 7 | [cols='1,1a',opts=header] 8 | |=== 9 | | AsciiDoc intrinsic attribute 10 | | Jekyll page variable 11 | 12 | | doctitle (aka the document title) 13 | | title 14 | 15 | | id 16 | | docid 17 | 18 | | author 19 | | author 20 | 21 | | revdate 22 | | date 23 | 24 | * Value is converted to a DateTime object 25 | * Applied only to documents in a collection such as `_posts` 26 | |=== 27 | 28 | Although not an implicit page attribute, another very common page attribute to set is `page-description`, which becomes `description` in the Jekyll page model. 29 | 30 | == Configured implicit page variables 31 | 32 | Under the `asciidoc` key in `_config.yml`, the `implicit_page_variables` key allows you to specify additional implicit page variables. 33 | The value may be specified as a single-line or multi-line array, or as a comma separated string. 34 | The specified page attributes are directly promoted to Jekyll page variables. 35 | A `page-` page attribute value overides a configured implicit page variable. 36 | For instance, these configurations are equivalent: 37 | 38 | [source,yml] 39 | ---- 40 | asciidoc: 41 | implicit_page_variables: 42 | - surprising 43 | - un-expected 44 | - when 45 | ---- 46 | 47 | [source,yml] 48 | ---- 49 | asciidoc: 50 | implicit_page_variables: [surprising, un-expected, when] 51 | ---- 52 | 53 | [source,yml] 54 | ---- 55 | asciidoc: 56 | implicit_page_variables: surprising, un-expected, when 57 | ---- 58 | 59 | Given a page: 60 | 61 | [source,adoc] 62 | ---- 63 | = Implicit Page Variables 64 | :surprising: It is surprising that 65 | :un-expected: an unexpected event could occur 66 | :when: when programming Ruby. 67 | :page-when: when writing in AsciiDoc. 68 | :not-implicit: Surprise! 69 | ---- 70 | 71 | and a layout containing the liquid template expression 72 | 73 | [source,html] 74 | ---- 75 |

{{ page.surprising }} {{ page.un-expected }}{{ page.not-implicit }} {{ page.when }}

76 | ---- 77 | 78 | the generated page will contain 79 | 80 | [source,html] 81 | ---- 82 |

It is surprising that an unexpected event could occur when writing in AsciiDoc.

83 | ---- -------------------------------------------------------------------------------- /docs/modules/ROOT/pages/templates.adoc: -------------------------------------------------------------------------------- 1 | = Customizing the Generated HTML 2 | 3 | You can use Asciidoctor converter templates to customize the HTML output that Asciidoctor generates for your site. 4 | Template files can be composed in any templating language that is supported by {url-tilt}[Tilt]. 5 | Each template file corresponds to a node in the AsciiDoc document tree (aka AST). 6 | 7 | Below are the steps you need to take to configure Asciidoctor to use custom templates with your site. 8 | 9 | == Step {counter:step}: Add Required Gems 10 | 11 | You'll first need to add the thread_safe gem as well as the gem for the templating language you plan to use into your projects `Gemfile`. 12 | We'll assume that you are using Slim. 13 | 14 | [source,ruby] 15 | ---- 16 | gem 'slim', '~> 3.0.7' 17 | gem 'thread_safe', '~> 0.3.5' 18 | ---- 19 | 20 | == Step {counter:step}: Install New Gems 21 | 22 | Now run the `bundle` command to install the new gems. 23 | 24 | $ bundle 25 | 26 | == Step {counter:step}: Create a Templates Folder 27 | 28 | Next, create a new folder in your site named `_templates` to store your templates. 29 | 30 | $ mkdir _templates 31 | 32 | == Step {counter:step}: Configure Asciidoctor to Load Templates 33 | 34 | In your site's `_config.yml` file, configure Asciidoctor to load the templates by telling it the location where the templates are stored. 35 | 36 | [source,yaml] 37 | ---- 38 | asciidoctor: 39 | template_dir: _templates 40 | attributes: ... 41 | ---- 42 | 43 | == Step {counter:step}: Compose a Template 44 | 45 | The final step is to compose a template. 46 | We'll be customizing the unordered list node. 47 | Name the file `ulist.html.slim`. 48 | 49 | .ulist.html.slim 50 | [source,slim] 51 | ---- 52 | - if title? 53 | figure.list.unordered id=id 54 | figcaption=title 55 | ul class=[style, role] 56 | - items.each do |_item| 57 | li 58 | span.primary=_item.text 59 | - if _item.blocks? 60 | =_item.content 61 | - else 62 | ul id=id class=[style, role] 63 | - items.each do |_item| 64 | li 65 | span.primary=_item.text 66 | - if _item.blocks? 67 | =_item.content 68 | ---- 69 | 70 | The next time you build your site, Asciidoctor will use your custom template to generate the HTML for unordered lists. 71 | 72 | TIP: You can find additional examples of custom templates in the {url-asciidoctor-backends}[asciidoctor-backends] repository. 73 | 74 | -------------------------------------------------------------------------------- /lib/jekyll-asciidoc/filters.rb: -------------------------------------------------------------------------------- 1 | # frozen_string_literal: true 2 | 3 | module Jekyll 4 | module AsciiDoc 5 | module Filters 6 | # A Liquid filter for converting an AsciiDoc string to HTML using {Converter#convert}. 7 | # 8 | # @param input [String] the AsciiDoc String to convert. 9 | # @param doctype [String] the target AsciiDoc doctype. 10 | # 11 | # @example Convert the AsciiDoc page excerpt to inline HTML 12 | # {{ page.excerpt | asciidocify: 'inline' }} 13 | # 14 | # @return [String] the converted result as an HTML-formatted String. 15 | def asciidocify input, doctype = nil 16 | (@context.registers[:cached_asciidoc_converter] ||= (Converter.get_instance @context.registers[:site])) 17 | .convert doctype ? %(:doctype: #{doctype}#{Utils::NewLine}#{input}) : (input || '') 18 | end 19 | 20 | # A Liquid filter for generating an HTML table of contents from a parsed AsciiDoc document. 21 | # 22 | # @param document [Asciidoctor::Document] the parsed AsciiDoc document for which to generate an HTML table of 23 | # contents. 24 | # @param levels [Integer] the maximum section depth to use; if not specified, uses the value of toclevels document 25 | # attribute. 26 | # 27 | # @example Generate a table of contents from the document for the current page 28 | # {{ page.document | tocify_asciidoc: 3 }} 29 | # 30 | # @return [String] the table of contents as an HTML-formatted String. 31 | def tocify_asciidoc document, levels = nil 32 | ::Asciidoctor::Document === document ? 33 | (document.converter.convert document, 'outline', toclevels: (levels.nil_or_empty? ? nil : levels.to_i)) : nil 34 | end 35 | 36 | # A Liquid filter for accessing docinfo from Asciidoctor. 37 | # 38 | # @param document [Asciidoctor::Document] the parsed AsciiDoc document. 39 | # @param location [Symbol] "head" (default), "header" or "footer" are the standard locations for html. 40 | # In the built-in Asciidoctor converter, "head" content is inserted just before the closing tag. 41 | # "header" content is inserted just before the default
tag (if used), and 42 | # "footer" content is inserted just after the default