jez / pandoc-sidenote

Convert Pandoc Markdown-style footnotes into sidenotes
MIT License
136 stars 17 forks source link

repeats sidenote number 1 for all foot/sidenotes #22

Closed ricopicone closed 3 years ago

ricopicone commented 3 years ago

I'm using pandoc-sidenote with my own Tufte CSS flavor (so I'm not using tufte-pandoc-css, but that's a cool project, too!). Everything seems to work fine except that every sidenote is labeled 1 despite the properties like <label for=sn-7 ...> seemingly incrementing. I think it has to do with counters and the CSS, but I haven't found it yet.

I'm using the Homebrew installation, version 0.22.1. I noticed that pandoc-sidenote --version and -v and -h all seem to hang. I reinstalled and get the same behavior. I'm not sure if it's related, but I thought it was worth noting.

Any advice? Thanks!

ricopicone commented 3 years ago

A live version of the site is here: http://robotics.ricopic.one/

jez commented 3 years ago

Hm, not super sure.

This project is basically just generating the same markup that tufte-css requires you write by hand.

I'm not sure what changes you've made on top of tufte-css or how you've structured your page, but I would suggest: try writing the HTML tags into your document by hand and see if it still doesn't work.

If you can't get any markup that works even when writing it by hand, it's not a problem in pandoc-sidenote. In that case, you're right that it's probably something to do with CSS counters. I'm not entirely sure, but I think they have weird rules about when the counter restarts from zero, and depending on how you're structuring your page, you might be tripping some unintuitive behavior. If this were me, at this point I'd make some sort of small example in JS Fiddle or codepen or something, and try to recreate my page's nesting structure in the sandbox. Making a small example would help to clarify what's important to reproduce the weird behavior and what's spurious.

If you can get it to work by hand, then from there you'll want to try to figure out what's different about the markup that pandoc-sidenote generates vs what markup you've written by hand.

ricopicone commented 3 years ago

I found it! Thanks for your advice. It turned out to be a custom stylesheet I load after tufte.css. The offending code was as follows.

body {
  counter-reset: section;
  counter-reset: equation;
}

I don't really know why this would be a problem;mdash;the Tufte sidenote counter is sidenote-counter, so there's no naming conflict.

In any case, I don't need those counters anyway, so I'm just eliminating them.