Skip to content

Commit 8774ea6

Browse files
committed
Add link to fpdf2 + .id on headings in maintainer-guidelines.md
1 parent 6c33fd0 commit 8774ea6

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

content/pages/maintainer-guidelines.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,3 +95,43 @@ Depending on the projects, the release process can be automated inside GitHub Ac
9595
<!-- TODO: use a dedicated Pypi user like Jazzband does? cf. https://jazzband.co/about/releases -->
9696

9797
<!-- TODO: add a section on Security & reporting vulnerabilities ? cf. https://jazzband.co/about/security -->
98+
99+
<script>
100+
const ANCHOR_ID_CHAR_RANGE_TO_IGNORE = '[\x00-\x2F\x3A-\x40\x5B-\x60\x7B-\uFFFF]+';
101+
function slugify(s) {
102+
var s = String(s)
103+
s = s.trim()
104+
s = s.toLowerCase()
105+
s = s.replace(new RegExp('^'+ANCHOR_ID_CHAR_RANGE_TO_IGNORE, 'g'), '')
106+
s = s.replace(new RegExp(ANCHOR_ID_CHAR_RANGE_TO_IGNORE, 'g'), '-')
107+
return encodeURIComponent(s);
108+
}
109+
document.querySelectorAll('h2').forEach(function (title) {
110+
// Add an HTML "id" based on the heading title slugified:
111+
title.id = slugify(title.textContent);
112+
// Add a clickable link on hover:
113+
var a = document.createElement('a');
114+
a.href = document.location + '#' + title.id;
115+
a['aria-hidden'] = true;
116+
a.style.float = 'left';
117+
a.style['padding-right'] = '4px';
118+
a.style['margin-left'] = '-20px';
119+
a.style['line-height'] = 1;
120+
title.appendChild(a);
121+
var svg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
122+
svg.setAttribute('aria-hidden', true);
123+
svg.setAttribute('height', 16);
124+
svg.setAttribute('width', 16);
125+
svg.setAttribute('viewBox', '0 0 16 16');
126+
svg.style.color = '#1b1f23';
127+
svg.style['vertical-align'] = 'middle';
128+
svg.style.visibility = 'hidden';
129+
a.appendChild(svg);
130+
var path = document.createElementNS('http://www.w3.org/2000/svg', 'path');
131+
path.setAttributeNS(null, 'fill-rule', 'evenodd');
132+
path.setAttributeNS(null, 'd', 'M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z');
133+
svg.appendChild(path);
134+
title.onmouseover = function () { this.getElementsByTagName('svg')[0].style.visibility = 'visible'; };
135+
title.onmouseout = function () { this.getElementsByTagName('svg')[0].style.visibility = 'hidden'; };
136+
});
137+
</script>

pelicanconf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
# Order the following by Github stars:
2424
# Either link to GitHub or to PyPI
2525
("pypdf and PyPDF2", "https://github.com/py-pdf/pypdf"),
26+
("fpdf2", "https://github.com/py-pdf/fpdf2"),
2627
("PyPDF-Builder", "https://github.com/py-pdf/PyPDF-Builder"),
2728
("pdfly", "https://github.com/py-pdf/pdfly"),
2829
)

0 commit comments

Comments
 (0)