New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow custom markdown processors #1872

Merged
merged 10 commits into from Dec 26, 2013

Conversation

Projects
None yet
4 participants
@parkr
Member

parkr commented Dec 26, 2013

Requires that the custom markdown processor be a constant defined within Jekyll::Converters::Markdown. Example:

If I want to add theoretical, biblical, mystical HTML Pipeline to my site as a custom processor, I define a converter plugin with #initialize and #convert defined, perhaps something like this:

require 'jekyll'
require 'html/pipeline'

class Jekyll::Converters::Markdown::HTMLPipeline
  def initialize(config)
    # You can do other fancy things with the config here,
    # but for now we'll just save it for later.
    @config = config
  end

  def convert(content)
    HTML::Pipeline.new(content).to_html(@config["html_pipeline_options"])
  end
end

Then in my _config.yml, I define the class I just created as my markdown:

markdown: HTMLPipeline

Run your Jekyll build, et voilà!

If you're writing your own markdown processor and are not sure where to start despite my above example, take a look at the KramdownParser class, a living, breathing, sweating markdown parser.


Props to @envygeeks and @gjtorikian. Let's make it happen!

  • Code
  • Tests
  • Documentation

Supersedes #1213, #1871. Closes #1871.

envygeeks and others added some commits Jun 15, 2013

Merge branch 'steal-envygeeks-custom-markdown-processors' of git://gi…
…thub.com/gjtorikian/jekyll into gjtorikian-steal-envygeeks-custom-markdown-processors

* 'steal-envygeeks-custom-markdown-processors' of git://github.com/gjtorikian/jekyll:
  Depend on Jekyll.logger.error, not $stderr
  Allow custom Markdown processors.
  New is implied by `raise`, 2nd is the message.
  Use $stderr, not STDERR, $stderr points to STDERR.

@ghost ghost assigned parkr Dec 26, 2013

parkr added some commits Dec 26, 2013

Extract checks for acceptable custom markdown processors to method.
We should probably write more about what it does and how it works in a TomDoc block above.
@envygeeks, want to give that a shot?
@parkr

This comment has been minimized.

Member

parkr commented Dec 26, 2013

Hello docs:

screen shot 2013-12-26 at 1 01 25 am

parkr added a commit that referenced this pull request Dec 26, 2013

@parkr parkr merged commit 5c4831a into master Dec 26, 2013

1 check passed

default The Travis CI build passed
Details

parkr added a commit that referenced this pull request Dec 26, 2013

@parkr parkr deleted the gjtorikian-steal-envygeeks-custom-markdown-processors branch Dec 26, 2013

@gjtorikian

This comment has been minimized.

Member

gjtorikian commented Dec 26, 2013

😂

With this (embiggened) emphasis on plugins, maybe it's appropriate to discuss how users can discover these features, outside of constantly updating the links on jekyllrb.com? /cc @benbalter @mattr-

@parkr

This comment has been minimized.

Member

parkr commented Dec 26, 2013

Would be happy to talk over some sort of search functionality. I have a horribly botched idea here: https://github.com/jekyll/plugins.jekyllrb.com

We'd expose plugins via JSON (name, author, keywords, what have you) and could conduct a search based on a keyword or something, so I could run jekyll plugin search redirect to search for all plugins with the "redirect" keyword or that have "redirect" in the name.

@gjtorikian

This comment has been minimized.

Member

gjtorikian commented Dec 26, 2013

Not a bad idea. We could piggyback it onto the GitHub search API for fun and profit.

@parkr

This comment has been minimized.

Member

parkr commented Dec 26, 2013

@gjtorikian Piggyback into GitHub Search API? How do you mean?

@envygeeks

This comment has been minimized.

Contributor

envygeeks commented Dec 26, 2013

That's not a bad idea, especially if you add a gem addon or something that queries the websites json and then does a gem install of "jekyll-plugin-name" something like jekyll plugin search tags -> jekyll plugin install my-tags -> gem install jekyll-plugin-my-tags or just throw it into the _plugins/ folder or add a --path command so they can designate a destination for non-gem installs.

@envygeeks

This comment has been minimized.

@jekyll jekyll locked and limited conversation to collaborators Feb 27, 2017

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.