{"id":16445790,"url":"https://github.com/mslinn/jekyll_draft","last_synced_at":"2025-10-27T05:31:56.679Z","repository":{"id":53841068,"uuid":"487852467","full_name":"mslinn/jekyll_draft","owner":"mslinn","description":"Special handling for draft Jekyll documents, detects several draft variants","archived":false,"fork":false,"pushed_at":"2025-01-10T18:38:27.000Z","size":954,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T03:08:13.048Z","etag":null,"topics":["jekyll","jekyll-filter","jekyll-tag","ruby-api"],"latest_commit_sha":null,"homepage":"https://www.mslinn.com/jekyll_plugins/jekyll_draft.html","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mslinn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-05-02T13:19:41.000Z","updated_at":"2025-01-10T18:38:30.000Z","dependencies_parsed_at":"2023-11-29T21:26:08.462Z","dependency_job_id":"2f1da72c-95c8-4329-ba1c-7f1d63dca584","html_url":"https://github.com/mslinn/jekyll_draft","commit_stats":{"total_commits":26,"total_committers":2,"mean_commits":13.0,"dds":"0.34615384615384615","last_synced_commit":"98f56570a90729a775f2e3ed54d020beab71e717"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mslinn%2Fjekyll_draft","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mslinn%2Fjekyll_draft/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mslinn%2Fjekyll_draft/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mslinn%2Fjekyll_draft/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mslinn","download_url":"https://codeload.github.com/mslinn/jekyll_draft/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238445863,"owners_count":19473825,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["jekyll","jekyll-filter","jekyll-tag","ruby-api"],"created_at":"2024-10-11T09:45:27.220Z","updated_at":"2025-10-27T05:31:56.673Z","avatar_url":"https://github.com/mslinn.png","language":"Ruby","readme":"# jekyll_draft [![Gem Version](https://badge.fury.io/rb/jekyll_draft.svg)](https://badge.fury.io/rb/jekyll_draft)\n\nJekyll has various ways of specifying that a page or document will be\nvisible when the website is published in `production` mode.\nThe Jekyll documentation is scattered and incomplete regarding detecting draft pages and documents.\nThis plugin provides standard ways for detecting draft pages and documents.\n\nYou can display the Jekyll mode that was active when a page was\ngenerated with `{{jekyll.environment}}`.\n\n`Jekyll_draft` provides the following:\n\n* Jekyll block tags: `if_draft`, `if_page_draft`, `unless_draft`, and `unless_page_draft`.\n* Jekyll inline tags: `else_if_draft`, `else_if_page_draft`,\n  `else_unless_draft` and `else_unless_page_draft`.\n  These are meant for use within the above block tags.\n  They are all identical; they are provided so usage seems natural.\n* Jekyll inline tag `draft_html`, which generates HTML that indicates if\n  the enclosing document or a specified is a draft.\n* Liquid filters:\n  * `is_draft` returns a boolean indicating if the document passed to it is a draft.\n  * `page_match_is_draft` is like `is_draft`, but works on other pages.\n  * `draft_html` returns the same string the `draft_html` tag returns,\n    indicating if the \u003ccode\u003eJekyll::Page\u003c/code\u003e passed to the filter is a draft.\n  * `page_match_draft_html` is like `draft_html` but works on other pages.\n    It accepts a string that will be matched against\n    [`APage.href`](https://github.com/mslinn/jekyll_all_collections?tab=readme-ov-file#the-apage-class)\n    values in \u003ccode\u003esite.everything\u003c/code\u003e.\n* Module `Jekyll::Draft` defines an API that your plugin can call.\n  It has the following methods:\n  * `draft?` returns a boolean indicating if the object passed to it is a draft.\n    It handles `AllCollectionsHooks::APage` instances, `Jekyll::Page` instances,\n    and `Jekyll::Document` instances.\n  * `draft_html` accepts the same parameter types as `draft?`,\n    and returns the same string that `draft_html` tag returns.\n    The response indicates if the document passed to it is a draft.\n  * `page_match` returns the `APage` whose `href` uniquely ends with the string passed to it.\n  * `root` returns the path to the root of the collection that the document passed to it is a member of.\n    This method is not functionally related to Jekyll draft documents.\n\nThe difference between the tag called `draft_html` and the filter of the same name\nis that the tag only works on the document that it is embedded in,\nwhile the filter works on any document passed to it.\nBoth the tag and the filter call the same API methods defined in the `Jekyll::Draft` module.\n\nMore information is available on [Mike Slinn\u0026rsquo;s website](https://www.mslinn.com/jekyll_plugins/jekyll_draft.html).\n\n\n## Front Matter\n\nTo mark a blog as a draft, put it in the `_drafts` directory.\n\nTo mark any other article as a draft, add the following to its front matter:\n\n```text\n---\npublished: false\n---\n```\n\n\n## Demo\n\nThe [demo/](demo) subdirectory has working examples of this Jekyll plugin's functionality\nin a demonstration website.\nIt can be used to debug the plugin or it can run freely.\nPlease examine the \u003ccode\u003eHTML\u003c/code\u003e files in the demo to see how the plugin works.\n\nTo run the demo freely from the command line, type:\n\n```console\n$ demo/_bin/debug -r\n```\n\nNow point your web browser to http://localhost:4444.\nYou should see:\n\n![jekyll_draft demo](jekyll_draft_demo.png)\n\nWhen the demonstration is running, any time you modify the \u003ccode\u003e.html\u003c/code\u003e files,\nthe demo website will regenerate.\nEach time you make a change, the website instantly regenerates.\nThis helps the learning experience.\n\nPlease play with the contents of the \u003ccode\u003e.html\u003c/code\u003e files,\nso you can learn how to write Jekyll pages that include this functionality.\n\n\n## Installation\n\n### For Use In A Jekyll Website\n\n1. Add the CSS found in [`demo/assets/css/jekyll_draft.css`](demo/assets/css/jekyll_draft.css) to your Jekyll layout(s).\n\n2. Add the following to your Jekyll website's `Gemfile`, within the `jekyll_plugins` group:\n\n   ```ruby\n   group :jekyll_plugins do\n     gem 'jekyll_plugin_support', '\u003e= 3.0.0'\n     gem 'jekyll_draft', '\u003e=3.0.0'\n   end\n   ```\n\n3. Type:\n\n   ```shell\n   $ bundle\n   ```\n\n4. Restart Jekyll.\n\n\n### For Use In a Gem\n\n1. Add the following to your gem\u0026rsquo;s `.gemspec`:\n\n   ```ruby\n   spec.add_dependency 'jekyll_plugin_support', '\u003e= 3.0.0'\n   spec.add_dependency 'jekyll_draft', '\u003e=3.0.0'\n   ```\n\n2. Type:\n\n   ```shell\n   $ bundle\n   ```\n\n\n## Configuration\n\n### _config.yml\n\nThe default settings run more quickly than id `verify_unique_match` is enabled,\nwhich guarantee that no broken internal links exist.\nIf a Jekyll web page has hundreds or thousands of pages,\nsite generation can take many minutes if `verify_unique_match` is enabled.\n\nThe following settings are the default values for `_config.yml`.\nThey apply to all tags defined by this plugin\n(`if_draft`, `unless_draft`, `if_page_draft`, `unless_page_draft`)\nexcept `draft_html` tag, which does not reference these settings:\n\n```yaml\nif_draft:\n  error_if_no_match: true\n  verify_unique_match: false\n```\n\n### Environment Variables\n\nEnvironment variables override `_config.yml` settings.\n\n* `if_draft_error_if_no_match` overrides `if_draft.error_if_no_match`\n* `if_draft_verify_unique_match` overrides `if_draft.verify_unique_match`\n\n\n## Usage in a Web Page\n\nThis section documents the usage of the inline and block tags described [above](#top).\n\nThe `if_draft` and `if_page_draft` block tags act as `if-then` or `if-then-else` programming constructs.\nDraft documents only exist in development mode.\nIn production mode, there is no way to programmatically detect if a draft document exists in development mode.\n\nThus, `if_draft` and `if_page_draft` actually mean \"if in development mode and the document is a draft\".\n\nFurthermore, `unless_draft` and `unless_page_draft` actually mean \"if in production mode or the document is not a draft\".\nThese block tags act as Ruby\n[`unless-then`](https://rubystyle.guide/#unless-for-negatives) and\n[`unless-then-else`](https://rubystyle.guide/#no-else-with-unless) programming constructs.\n\nThe `draft_html` inline tag generates HTML that indicates if a page is a draft or not.\n\n\n### `if_draft` and `unless_draft` Block Tags\n\nThese tags consider the status of the document that the tag is embedded in.\n\nThe \u003ccode\u003eif_draft\u003c/code\u003e block tag acts as an \u003ccode\u003eif-then\u003c/code\u003e or an \u003ccode\u003eif-then-else\u003c/code\u003e programming construct.\n\nThe following generates `\u003cp\u003eThis is a draft document!\u003c/p\u003e`\nif the document it is embedded in is a draft,\nand the Jekyll website generation was performed in development mode:\n\n```html\n{% if_draft %}\n  \u003cp\u003eThis is a draft document.\u003c/p\u003e\n{% endif_draft %}\n```\n\nThe following enhances the previous example by generating `\u003cp\u003eThis is not a draft document!\u003c/p\u003e`\nif the document this code is embedded in is not a draft.\nThe message for the else clause is generated for documents that are not drafts,\nregardless of whether Jekyll is in `production` or `development` mode.\n\n```html\n{% if_draft %}\n  \u003cp\u003eThis is a draft document!\u003c/p\u003e\n{% else_if_not_draft %}\n  \u003cp\u003eThis is not a draft document!\u003c/p\u003e\n{% endif_draft %}\n```\n\nThe `unless_draft` block tag switches the then and else clauses of the `if_draft` block tag.\nIt acts as a Ruby [\u003ccode\u003eunless-then\u003c/code\u003e](https://rubystyle.guide/#unless-for-negatives) or\n[\u003ccode\u003eunless-then-else\u003c/code\u003e](https://rubystyle.guide/#no-else-with-unless) programming construct.\n\n```html\n{% unless_draft %}\n  \u003cp\u003eThis is not a draft document!\u003c/p\u003e\n{% endunless_draft %}\n```\n\n```html\n{% unless_draft %}\n  \u003cp\u003eThis is not a draft document!\u003c/p\u003e\n{% else_unless_draft %}\n  \u003cp\u003eThis is a draft document!\u003c/p\u003e\n{% endunless_draft %}\n```\n\n\n### `if_page_draft` and `unless_page_draft` Block Tags\n\nThese tags consider the status of the document whose url uniquely includes the specified string.\n\nAn error is raised in `development` mode if no page exists whose URL contains the matching string.\n\nThe following generates `\u003cp\u003e\u003ccode\u003e/directory/blah_blah.html\u003c/code\u003e is a draft document!\u003c/p\u003e`\nif the rendered page with a url that ends with the string `blah.html` in is a draft,\nand the Jekyll website generation was performed in development mode,\nand the only page with a matching URL is \u003ccode\u003e/directory/blah_blah.html\u003c/code\u003e:\n\n```html\n{% if_page_draft blah.html %}\n  \u003cp\u003e\u003ccode\u003e{{matched_page.url}}\u003c/code\u003e is a draft document.\u003c/p\u003e\n{% endif_page_draft %}\n```\n\nNotice the reference to a Jekyll variable called `matched_page` in the above example.\nIt is set to the Jekyll `Page` whose `url` uniquely matched the string following the `if_page_draft` tag.\nThis variable is only defined for `development` mode within the `then` clause of the `if_page_draft` tag,\nand for the `else` clause of the `unless_page_draft` block tag.\n\nYou can specify any `Page` attribute with `matched_page`, for example {{matched_page.title}}.\n\nThe following generates `\u003cp\u003e\u003ccode\u003e/directory/blah_blah.html\u003c/code\u003e is not a draft document!\u003c/p\u003e`\nif the `/directory/blah_blah.html` in is a draft document,\nand the Jekyll website generation was performed in development mode:\n\n```html\n{% unless_page_draft blah.html %}\n  \u003cp\u003e\u003ccode\u003e{{matched_page.url}}\u003c/code\u003e is not a draft document!\u003c/p\u003e\n{% endunless_draft %}\n```\n\nThe following shows how to specify `else` clauses for `if_page_draft` and `unless_page_draft`.\nNote that the `if_draft` else clause activates in `production` mode regardless of whether a page matches or not,\nso you should not reference `matched_page` in an else clause without testing\n[`jekyll.environment`](https://jekyllrb.com/docs/configuration/environments/).\nInstead, you can reference the match string with `{{path_portion}}`:\n\n```html\n{% if_page_draft blah.html %}\n  \u003cp\u003e\u003ccode\u003e{{matched_page.url}}\u003c/code\u003e is a draft document!\u003c/p\u003e\n{% else_if_page_draft %}\n  {% if jekyll.environment == 'development' %}\n    \u003cp\u003e\u003ccode\u003e{{matched_page.url}}\u003c/code\u003e is not a draft document!\u003c/p\u003e\n  {% else %}\n    \u003cp\u003eProduction mode cannot detect if \u003ccode\u003e{{path_portion}}\u003c/code\u003e matches a draft document or not.\u003c/p\u003e\n  {% endif %}\n{% endif_page_draft %}\n```\n\nSimilarly, the `unless_draft` then clause activates in `production` mode regardless of whether a page matches or not,\nso you should not reference `matched_page` in a then clause without testing\n[`jekyll.environment`](https://jekyllrb.com/docs/configuration/environments/).\n\n```html\n{% unless_page_draft blah.html %}\n  {% if jekyll.environment == 'development' %}\n    \u003cp\u003eThe page whose URL contains \u003ccode\u003e{{path_portion}}\u003c/code\u003e is not a draft document!\u003c/p\u003e\n  {% else %}\n    \u003cp\u003eProduction mode cannot detect if \u003ccode\u003e{{path_portion}}\u003c/code\u003e matches a draft document or not.\u003c/p\u003e\n  {% endif %}\n{% else_unless_page_draft %}\n  \u003cp\u003e\u003ccode\u003e{{matched_page.url}}\u003c/code\u003e is a draft document!\u003c/p\u003e\n{% endunless_page_draft %}\n```\n\nAs with the `if_page_draft` and `unless_page_draft` examples, the above example\nreferences scoped Jekyll variables called `matched_page` and `path_portion`.\nThese variables are only defined within the body of `if_page_draft` and `unless_page_draft` blocks.\n\n\n### Else Clauses\n\nYou can use the keywords\n`else_if_draft`, `else_if_page_draft`, `else_unless_draft`, and `else_unless_page_draft` interchangeably.\nThey are actually made by registering the same code multiple times with different subclass names.\nUse the keyword that makes the most sense to you.\n\n\n### `draft_html` Inline Tag\n\n#### Default Behavior\n\nThe `draft_html` inline tag can return the status of the page it is embedded in, or any other page that exists.\nRecall that draft pages do not exist in `production` mode.\n\nHere is an example of embedding the `draft_html` inline tag into an HTML document:\n\n```html\n  \u003cp\u003eIs this a draft document? Look here to see: {% draft_html %}\u003c/p\u003e\n```\n\nBy default, if the document is a draft, and the Jekyll website generation was performed in development mode,\n`draft_html` emits ` \u003ci class='jekyll_draft'\u003eDraft\u003c/i\u003e`,\notherwise it does not emit anything.\n\n\u003cp\u003eYou can change this behavior in several ways:\u003c/p\u003e\n\n* Add the \u003ccode\u003edraft_output\u003c/code\u003e parameter to specify the HTML that should be\n  emitted if the document is a draft,\n  and the Jekyll website generation was performed in development mode:\n\n  ```text\n  {% draft_html\n    draft_output=\"\u003cp\u003eIs a draft\u003c/p\u003e\"\n  %}\n\n  {% draft_html\n    draft_output=\"\u003cp\u003eIs a draft\u003c/p\u003e\"\n    published_output=\"\u003cp\u003eNot a draft\u003c/p\u003e\"\n  %}\n  ```\n\n* Add the \u003ccode\u003epublished_output\u003c/code\u003e parameter to specify the HTML that\n  should be emitted if the document is not a draft.\n  The default message will continue to be output for draft documents when the\n  \u003ccode\u003epublished_output\u003c/code\u003e parameter is used.\n\n  ```text\n  {% draft_html published_output=\"\u003cp\u003eNot a draft\u003c/p\u003e\" %}\n  ```\n\n* Add the \u003ccode\u003edraft_class\u003c/code\u003e parameter to specify the CSS class that should be added\n  to the emitted HTML if the document is a draft,\n  and the Jekyll website generation was performed in development mode:\n\n  ```text\n  {% draft_html draft_class=\"my_draft_class\" %}\n\n  {% draft_html\n    draft_class=\"my_draft_class\"\n    published_output=\"\u003cp\u003eNot a draft\u003c/p\u003e\"\n  %}\n  ```\n\n* Add the \u003ccode\u003edraft_style\u003c/code\u003e parameter to specify the CSS class that should be added\n  to the emitted HTML if the document is a draft,\n  and the Jekyll website generation was performed in development mode:\n\n  ```text\n  {% draft_html draft_style=\"font-size: 24pt;\" %}\n\n  {% draft_html\n    draft_class=\"my_draft_class\"\n    draft_style=\"font-size: 24pt;\"\n  %}\n\n  {% draft_html\n    draft_class=\"my_draft_class\"\n    draft_style=\"font-size: 24pt;\"\n    published_output=\"\u003cp\u003eNot a draft\u003c/p\u003e\"\n  %}\n  ```\n\n\n#### Testing Another Page\n\nThe `path_portion` option enables the `draft_html` tag to report on the draft status\nof other pages when Jekyll is in `development` mode.\nBy default, an empty string is always returned when in `production` mode.\n\n```html\n\u003cp\u003e\n  Is \u003ccode\u003e/directory/blah_blah.html\u003c/code\u003e a draft document?\n  Look here to see: {% draft_html path_portion='blah.html' %}\n\u003c/p\u003e\n```\n\nIt might be desirable to enclose the above in a test for Jekyll mode as follows:\n\n```html\n{% if jekyll.environment == \"development\" %}\n  \u003cp\u003e\n    Is \u003ccode\u003e/directory/blah_blah.html\u003c/code\u003e a draft document?\n    Look here to see: {% draft_html path_portion='blah.html' %}\n  \u003c/p\u003e\n{% endif %}\n```\n\n\n#### Additional Options\n\nIn addition to the `path_portion` option, the following can be also be specified:\n\n* Add the `published_output` parameter to specify the HTML that should be emitted if the document is not a draft,\nand the Jekyll website generation was performed in development mode.\nThe default message will continue to be output for draft documents when the `published_output` parameter is used.\n\n  ```html\n  {% draft_html published_output=\"\u003cp\u003eNot a draft\u003c/p\u003e\" %}\n  ```\n\n* Add the `draft_output` parameter to specify the HTML that should be emitted if the document is a draft,\nand the Jekyll website generation was performed in development mode:\n\n  ```html\n  {% draft_html\n       draft_output=\"\u003cp\u003eIs a draft\u003c/p\u003e\"\n  %}\n  {% draft_html\n       draft_output=\"\u003cp\u003eIs a draft\u003c/p\u003e\"\n       published_output=\"\u003cp\u003eNot a draft\u003c/p\u003e\"\n  %}\n  ```\n\n* Add the `draft_class` parameter to specify the CSS class that should be added\n  to the emitted HTML if the document is a draft\n  and the Jekyll website generation was performed in development mode:\n\n  ```html\n  {% draft_html draft_class=\"my_draft_class\" %}\n  {% draft_html\n       draft_class=\"my_draft_class\"\n       published_output=\"\u003cp\u003eNot a draft\u003c/p\u003e\"\n  %}\n  ```\n\n* Add the `draft_style` parameter to specify the CSS class that should be added\n  to the emitted HTML if the document is a draft,\n  and the Jekyll website generation was performed in development mode:\n\n  ```html\n  {% draft_html draft_style=\"font-size: 24pt;\" %}\n  {% draft_html\n       draft_class=\"my_draft_class\"\n       draft_style=\"font-size: 24pt;\"\n  %}\n  {% draft_html\n       draft_class=\"my_draft_class\"\n       draft_style=\"font-size: 24pt;\"\n       published_output=\"\u003cp\u003eNot a draft\u003c/p\u003e\"\n  %}\n  ```\n\n\n### Liquid Filters\n\n#### `draft_html`\n\nBy default, the draft_html Liquid filter generates HTML if a page is invisible when published in `production` mode.\nIf the page is not a draft, then the empty string is returned.\n\nThe optional parameters for the `draft_html` inline tag are not available for\nuse with the `draft_html` filter.\n\nThe default generated HTML for draft pages is:\u003cbr\u003e\n`\" \u003ci class='jekyll_draft'\u003eDraft\u003c/i\u003e\"`\n\nInvoke the filter like the following; the output depends on whether the document is a draft:\n\n```html\n{{ page | draft_html }} =\u003e \" \u003ci class='jekyll_draft'\u003eDraft\u003c/i\u003e\"\n```\n\nHere is a code snippet that shows the \u003ccode\u003edraft_html\u003c/code\u003e filter in use:\n\n```html\n{% assign docs = site.myCollection | sort: \"order\" %}\n\u003col id=\"titles\"\u003e\n{% for doc in docs %}\n  \u003cli\u003e\n    \u003ca href=\"{{doc.url}}\" class=\"title\"\u003e{{doc.title}}\u003c/a\u003e{{ doc | draft_html }}\n  \u003c/li\u003e\n{% endfor %}\n\u003c/ol\u003e\n```\n\n\n#### `page_match_draft_html`\n\nThis filter detects if the page whose URL uniquely contains a string is\ninvisible when published in `production` mode,\nand returns the same strings that `draft_html` returns.\n\n```html\n{{ \"unpublished.html\" | page_match_draft_html }}\n```\n\n\n#### `is_draft`\n\nThis filter detects if a page is invisible when published in `production` mode,\nand returns `true` or `false`.\n\n```html\n{{ page | is_draft }} \u003c!-- true for draft documents in development mode --\u003e\n```\n\n\n#### `page_match_is_draft`\n\nThis filter detects if the page whose URL uniquely contains a string is\ninvisible when published in `production` mode,\nand returns `true` or `false`.\n\n```html\n{{ \"unpublished.html\" | page_match_is_draft }}\n```\n\n\n### Invoking From Another Jekyll Plugin\n\n```ruby\nrequire 'jekyll_draft'\n\nputs 'Found a draft' if Jekyll::Draft.draft? post\n\ndraft = Jekyll::Draft.draft_html post\n```\n\n\n### Usage in a Plugin\n\nThe methods in `lib/draft_html.rb` can be invoked by qualifying them with `Jekyll::Draft`.\nHere is a complete example of a Jekyll Support plugin that displays an indication of whether the page is a draft or not:\n\n```ruby\nrequire 'jekyll_plugin_support'\n\nmodule MyPluginTag\n  MyPluginError = JekyllSupport.define_error\n  PLUGIN_NAME = 'my_plugin'.freeze\n  VERSION = '0.1.0'.freeze\n\n  class MyPluginTag \u003c JekyllSupport::JekyllTag\n    def render_impl\n      \u003c\u003c~HEREDOC\n        Draft or not? #{Jekyll::Draft.draft_html(@page)}\n      HEREDOC\n    end\n  end\nend\n\nLiquid::Template.register_tag(MyPluginTag::PLUGIN_NAME, MyPluginTag::MyPluginTag)\nPluginMetaLogger.instance.info { \"Loaded #{MyPluginTag::PLUGIN_NAME} v#{MyPluginTag::VERSION} plugin.\" }\n```\n\n\n## Development\n\n### Setup\n\nAfter checking out the repo, run `bin/setup` to install dependencies.\nYou can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nInstall development dependencies like this:\n\n```shell\n$ BUNDLE_WITH=development bundle\n```\n\nTo install this gem onto your local machine, run:\n\n```shell\n$ bundle exec rake install\n```\n\n### Debugging The Demo\n\nSet breakpoints, then use the Visual Studio Code launch configuration called `Debug Demo`.\n\n\n### Debugging From Another Jekyll Site\n\nRun `bin/attach` and pass the directory name of a Jekyll website that has a suitable script called `_bin/debug`.\nThe `demo` subdirectory fits this description.\n\n```console\n$ bin/attach demo\nSuccessfully uninstalled jekyll_draft-1.1.2\nSuccessfully uninstalled jekyll_draft-2.0.0\njekyll_draft 2.0.0 built to pkg/jekyll_draft-2.0.0.gem.\njekyll_draft (2.0.0) installed.\njekyll_draft 2.0.0 built to pkg/jekyll_draft-2.0.0.gem.\njekyll_draft (2.0.0) installed.\nFetching gem metadata from https://rubygems.org/..........\nResolving dependencies...\nBundle complete! 21 Gemfile dependencies, 104 gems now installed.\nUse `bundle info [gemname]` to see where a bundled gem is installed.\n\n\nINFO PluginMetaLogger: Loaded else_if_draft v0.1.0 plugin.\nINFO PluginMetaLogger: Loaded else_if_not_draft v0.1.0 plugin.\nINFO PluginMetaLogger: Loaded String and String, v2.0.0 plugin.\nINFO PluginMetaLogger: Loaded if_draft v2.0.0 plugin.\nINFO PluginMetaLogger: Loaded unless_draft v2.0.0 plugin.\nINFO PluginMetaLogger: Loaded String and String, v2.0.0 plugin.\nINFO PluginMetaLogger: Loaded exec v1.4.2 plugin.\nINFO PluginMetaLogger: Loaded noselect v1.4.2 plugin.\nINFO PluginMetaLogger: Loaded pre v1.4.2 plugin.\nINFO PluginMetaLogger: Loaded jekyll_pre v1.4.2 plugin.\nConfiguration file: /mnt/f/work/jekyll/my_plugins/jekyll_draft/demo/_config.yml\n           Cleaner: Removing /mnt/f/work/jekyll/my_plugins/jekyll_draft/demo/_site...\n           Cleaner: Removing /mnt/f/work/jekyll/my_plugins/jekyll_draft/demo/.jekyll-metadata...\n           Cleaner: Removing /mnt/f/work/jekyll/my_plugins/jekyll_draft/demo/.jekyll-cache...\n           Cleaner: Nothing to do for .sass-cache.\nDEBUGGER: Debugger can attach via TCP/IP (127.0.0.1:45409)\nDEBUGGER: wait for debugger connection...\n```\n\nNow attach to the debugger process.\nThis git repo includes a [Visual Studio Code launcher](.vscode/launch.json) for this purpose labeled `Attach rdbg`.\nIt uses TCP/IP port 45409 to attach; you might need to modify that value.\n\nNow point your web browser to http://localhost:4444\n\n\n### Releasing A New Version\n\nTo release a new version,\n\n  1. Update the version number in `version.rb`.\n  2. Commit all changes to git; if you don't the next step might fail with an unexplainable error message.\n  3. Run the following:\n\n     ```shell\n     $ bundle exec rake release\n     ```\n\n     The above creates a git tag for the version, commits the created tag,\n     and pushes the new `.gem` file to [RubyGems.org](https://rubygems.org).\n\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/mslinn/jekyll_draft.\n\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmslinn%2Fjekyll_draft","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmslinn%2Fjekyll_draft","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmslinn%2Fjekyll_draft/lists"}