Skip to content
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

parkr
Copy link
Member

@parkr 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.

Jordon and others added 6 commits December 25, 2013 19:36
…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
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
Copy link
Member Author

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
parkr added a commit that referenced this pull request Dec 26, 2013
@parkr parkr deleted the gjtorikian-steal-envygeeks-custom-markdown-processors branch December 26, 2013 06:06
@gjtorikian
Copy link
Member

😂

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
Copy link
Member Author

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
Copy link
Member

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

@parkr
Copy link
Member Author

parkr commented Dec 26, 2013

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

@envygeeks
Copy link
Contributor

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
Copy link
Contributor

@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants