markdown-it / markdown-it-footnote

Footnotes plugin for markdown-it markdown parser
https://markdown-it.github.io/
MIT License
212 stars 59 forks source link

Suggestion to change a look of duplicated references #19

Closed john-cj closed 7 years ago

john-cj commented 7 years ago

Currently, duplicated references looks like this:

Duplicated footnote reference[2:1]

Which means "first repeat of second footnote". From my very personal point of view, it looks a bit confusing. There are 2 reasons:

  1. Reference "2:1" looks like subordinate of reference "2". (Like in numbered lists, where item "2.1" is always subordinate of item "2").
  2. "2:1" is also looks like link to religious texts. For example, you could google "Numbers 14:18" to understand what I mean.

Possible solution (Just a draft, I haven't seriously thinked about it. But at first glance, looks ok)

Use dash instead of colon. Also, if there are multiple references for single footnote, the first reference should be prefixed with 1-, second with 2- and so on. If there are only one reference, then there are no prefixes is needed. Example:

Footnote 1 reference1

Footnote 2 reference2-1

Duplicated reference for second footnote2-2

Update

Another idea, maybe even better, is just leave references plain. Example:

Footnote 1 reference1

Footnote 2 reference2

Duplicated reference for second footnote2

This is more logical, because reference is link to "something". And so, references "2:1" and "2:2" could be incorrectly interpreted by the reader as links to different footnotes.

Wikipedia agrees with me, see screenshot. There are no pre- or post-fixes before/after "[3]" in main text.

image

Screenshot taked from article about Times New Roman. You could check it yourself: https://en.wikipedia.org/wiki/Times_New_Roman

puzrin commented 7 years ago

No plans to change defaults now. You can override renderer and customize look for your needs. That does not require any change in package.

john-cj commented 7 years ago

Ok, thanks. As I understand, you mean some custom function, like shown in markdown-it-container readme, right?

md.use(require('markdown-it-container'), 'spoiler', {

  validate: function(params) {
    return params.trim().match(/^spoiler\s+(.*)$/);
  },

  render: function (tokens, idx) {
    var m = tokens[idx].info.trim().match(/^spoiler\s+(.*)$/);

    if (tokens[idx].nesting === 1) {
      // opening tag
      return '<details><summary>' + md.utils.escapeHtml(m[1]) + '</summary>\n';

    } else {
      // closing tag
      return '</details>\n';
    }
  }
});

Hm, probably will be a bit tricky for newbies like me, hah :smiley: