clayh53 / tufte-jekyll

Minimal Jekyll blog styled to resemble the look and layout of Edward Tufte's books
MIT License
627 stars 207 forks source link

FYI: It is possible to have sidenotes numbered #13

Closed reitzig closed 8 years ago

reitzig commented 8 years ago

Myself, I like that I can set the sidenotes labels myself, e.g. to use letters (and numbers for footnotes or citing).

However, in case you want them to be numbered but did not know how (I had to dig a while, for another plugin), this is how you can do it.

We use the context parameter that is passed to a tag's render method. It is cleared after every build, but not during a single page is built.

page = context.registers[:page]

if !page.has_key?("sidenote-number") # something unique
  page["sidenote-number"] = 0 
end
page["sidenote-number"] += 1
clayh53 commented 8 years ago

I am putting the finishing touches on Ver 2 and it has automatic numbering of sidenotes on each page. Using a CSS counter technique. It will be up in the next few days.

On Oct 5, 2015, at 6:54 PM, Raphael R. notifications@github.com wrote:

Myself, I like that I can set the sidenotes labels myself, e.g. to use letters (and numbers for footnotes or citing).

However, in case you want them to be numbered but did not know how (I had to dig a while, for another plugin), this is how you can do it.

We use the context parameter that is passed to a tag's render method. It is cleared after every build, but not during a single page is built.

page = context.registers[:page]

if !page.has_key?("sidenote-number") # something unique page["sidenote-number"] = 0 end page["sidenote-number"] += 1 — Reply to this email directly or view it on GitHub.

clayh53 commented 8 years ago

The new version is live and has auto numbering

reitzig commented 8 years ago

Looking forward to v2 then, super!