AngeloStavrow / indigo

An IndieWeb-friendly custom theme for Hugo
MIT License
58 stars 33 forks source link

highlight shortcode makes code very hard to read #89

Closed maxbla closed 4 years ago

maxbla commented 4 years ago

This is basically unreadable!

hugo_before

Simply removing some css turns it into this, much better.

hugo_after

I can submit a PR with the CSS I removed, but It might make more sense to change the CSS to play nice with both backtick code blocks and highlight shortcodes.

AngeloStavrow commented 4 years ago

Hey @maxbla, thanks for filing this issue — I'm not much of a shortcode user in Hugo, so this was in my blindspot. Great catch!

I'm having a little trouble finding many shortcodes in the Hugo docs for code. Is this coming from the {{< gist >}} shortcode? If you can help me reproduce this, then it'll be quicker to fix. 🙂

maxbla commented 4 years ago

It is coming from the hightlight shortcode. The screenshot was generated with the following markdown

{{< highlight python >}}
def log_2(num):
    """
    Integer logarithm base 2. Returns the integer part of the log base 2
    """
    iterations = 0
    while(num > 1):
        num = num >> 1
        iterations += 1
    return iterations

def ln(num):
    """
    Approximates the natural logarithm of an integer
    Error is bounded by 1/binary_log_e ~ 0.69
    Uses the change of base formula
    """
    binary_log_e = 1.442695040888  # log base 2 of e
    return log_2(num)/binary_log_e

def pi(num):
    """
    Approximates the prime counting function
    """
    return num//(int(ln(num)))

{{</highlight >}}

Let me know if you can't reproduce my screenshots, and I can give your more info.

AngeloStavrow commented 4 years ago

I just realized I referenced this in #78:

Code blocks in general could be improved, as they don't play very nicely with Hugo's highlight shortcodes either.

Originally posted by @AngeloStavrow in https://github.com/AngeloStavrow/indigo/issues/78#issuecomment-587666053

It's probably worth tackling both issues at the same time.

maxbla commented 4 years ago

I decided #78 wasn't applicable because the title specifically mentioned MS edge. Maybe the MS Edge suffix could be removed.

Would you find it useful for me to post the CSS change and the screenshots in that issue instead?

AngeloStavrow commented 4 years ago

Nope, no worries for that! You made the right choice to open a new issue, as they're materially different issues. 🙂

Both problems just happen to involve the same bit of my less-than-awesome CSS. 😂