~xj9/bbnet

c608405782149c1bcf4c01a182575ca4ebe7cb8b — xj9 a month ago 9e1fccd
anchor link generation
2 files changed, 26 insertions(+), 15 deletions(-)

M gemini2html.py
M static/spirit.css
M gemini2html.py => gemini2html.py +10 -3
@@ 61,9 61,16 @@ def gmi_to_html(lines):
                    value=escape(value.strip())
                )
            elif header_match and not pre_toggle:
                yield '<h{level}>{value}</h{level}>\n'.format(
                    level=len(header_match[1]),
                    value=escape(header_match[2])
                value = header_match[2].strip()
                level = len(header_match[1])
                safe_value = escape(header_match[2])
                yield '<h{level} id="{slug}"><a href="#{slug}">{value}</a></h{level}>\n'.format(
                    level=level,
                    value=safe_value,
                    slug='{slug}-h{level}'.format(
                        level=level,
                        slug=escape(value.lower()).replace(' ', '-')
                    )
                )
            elif link_match and not pre_toggle:
                href = link_match[1]

M static/spirit.css => static/spirit.css +16 -12
@@ 3,10 3,8 @@ header,
th,
h1,
h2,
h3,
h4,
h5,
h6 {
h3 {
	position: relative;
	color: var(--base0D);
}



@@ 27,14 25,6 @@ th {
	font-size: 1.5rem;
}

h4 {
	font-size: 1.25rem;
}

h5 {
	font-size: 1.125rem;
}

hr {
	color: var(--base0B);
}


@@ 90,6 80,20 @@ a[href] {
	border-bottom: 1px solid;
}

h1 a[href],
h2 a[href],
h3 a[href] {
	border-bottom: none;
}

h1:hover::before,
h2:hover::before,
h3:hover::before {
	position: absolute;
	left: -1.5rem;
	content: "\2192";
}

img {
	max-width: 100%;
}