public
Last active

Jekyll markdown references plugin by Olov Lassus: Keep all your markdown reference-style link definitions in one file (_references.md)

  • Download Gist
references.rb
Ruby
1
# references.rb has moved to https://github.com/olov/jekyll-references

It doesn't work both on GitHub and my local. I forked one and did some fix for my local, but also can't work on GitHub.

Jekyll issue here: #557.

I'll gladly merge your changes into my version to simplify things on the Jekyll plugins page, with proper credit to you of course. But I would like to understand your issue first, and I haven't been able to reproduce it. I'm running Jekyll 0.11.2.

Can you provide more detail such as error messages and your _references.md? Does it work better if you disable any other plugins you may have installed? Thanks!

I'm so sorry! I don't know why but It works now! I just switch Jekyll version to 0.11.0 and switched back to 0.11.2, then both are OK.

BTW, I found why I can't run any plugins on GitHub, the issue here: #325.

I guess that's a good thing. :) I cleaned up the plugins-page again. Where you able to trigger a bug if not prepending refs_content with newlines? If so I'll add that to my gist.

Yes, really it happens. I guess it may be the problem I met before. This a Markdown code in tail of a file:

...
-EOF-(without newlines)

then your converter can't recognize references. If I put a newline, then it works right.

And I think if putting the appending process in MarkdownConverter may be better and clear. So I made my fix in my fork.

Thanks. I'm able to reproduce that issue. I've fixed it in the gist by inserting a newline between content and the references.

This doesn't work with the following setting

{% capture content %}
Foo [some link][some-id] bar.
{% endcapture %}

It will complain that some-id is not known. (And yes it is inside a file called _references.md.)

Err, that code should have read as follows:

{% capture content %}
Foo [some link][some-id] bar.
{% endcapture %}

{{ content | markdownify }}

@spockz The plugin works on the markdown file level in such a way that it just concatenates _references.md to the end at every .md file it is about to process (it hooks into read_yaml).

For your use-case, we should instead hook into the Markdown class (convert method). That should be pretty straight-forward. Feel free to take a stab at it yourself (please poke me if so) - I may or may not get around to doing it myself.

@spockz Alright I changed the hook so it should work now

This Gist has moved to a GitHub project for easier collaboration. Get it from https://github.com/olov/jekyll-references

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.