~sircmpwn/core.sr.ht

6003ccc812b047f72b56f7db2be85f53fafa3f32 — gildarts 1 year, 1 month ago 555e10e 0.64.3
Add bare anchor tag for header link
3 files changed, 19 insertions(+), 2 deletions(-)

M srht/markdown.py
M srht/scss/base.scss
M srht/templates/layout.html
M srht/markdown.py => srht/markdown.py +2 -2
@@ 12,7 12,7 @@ import mistletoe as m
from mistletoe.span_token import SpanToken, RawText
import re

SRHT_MARKDOWN_VERSION = 8
SRHT_MARKDOWN_VERSION = 9

class PlainLink(SpanToken):
    """


@@ 114,7 114,7 @@ class SrhtRenderer(m.HTMLRenderer):
        return template.format(attr=attr, inner=inner)

    def render_heading(self, token):
        template = '<h{level} id="{_id}">{inner}</h{level}>'
        template = '<h{level} id="{_id}"><a href="#{_id}">#</a>{inner}</h{level}>'
        level = token.level + self.baselevel
        if level > 6:
            level = 6

M srht/scss/base.scss => srht/scss/base.scss +15 -0
@@ 297,10 297,25 @@ code {
  }

  h1, h2, h3, h4, h5, h6 {
    position: relative;
    display: flex;
    margin-top: 1em;
    align-items: center;

    &:first-child {
      margin-top: 0;
    }

    & > a:first-child {
      transition: opacity 0.15s linear;
      opacity: 0;
      position: absolute;
      font-size: 1.2rem;
      left: -1rem;
    }

    &:hover > a:first-child {
      opacity: 1;
    }
  }
}

M srht/templates/layout.html => srht/templates/layout.html +2 -0
@@ 45,5 45,7 @@
    {% endblock %}
    {% block modal %}{% endblock %}
    {% block scripts %}{% endblock %}
    <!-- https://bugs.chromium.org/p/chromium/issues/detail?id=332189 -->
    <script> </script>
  </body>
</html>