Skip to content

Instantly share code, notes, and snippets.

@olov
Last active September 25, 2015 17:58
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save olov/961336 to your computer and use it in GitHub Desktop.
Save olov/961336 to your computer and use it in GitHub Desktop.
Jekyll markdown references plugin by Olov Lassus: Keep all your markdown reference-style link definitions in one file (_references.md)
# references.rb has moved to https://github.com/olov/jekyll-references
@mytharcher
Copy link

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.

@olov
Copy link
Author

olov commented May 22, 2012

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

@spockz
Copy link

spockz commented Sep 13, 2012

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.)

@spockz
Copy link

spockz commented Sep 13, 2012

Err, that code should have read as follows:

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

{{ content | markdownify }}

@olov
Copy link
Author

olov commented May 6, 2013

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

@olov
Copy link
Author

olov commented May 6, 2013

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

@olov
Copy link
Author

olov commented May 6, 2013

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

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