Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix overflow of indented code-blocks in lists #10782

Conversation

Amorpheuz
Copy link
Contributor

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Documentation Update

Description

Adds styling for .highlight to <pre> inside <li>. I checked out the Rouge/redcarpet plugin file which indicates that the .highlight class should be applied to all code-blocks by default since DEV is using the default version too. I felt it would be a simpler fix via the CSS Route instead of configuring a custom renderer, which might lead to more bugs.

I did basic testing with the following article piece, to ensure that behavior for other elements didn't get switched:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Proin eget nunc sed dolor molestie eleifend. Nulla ut ante ultricies quam accumsan commodo.

```yml
- name: Get a dad-joke
  run: |
    echo "::set-env name=TEMP::$(curl -H "Accept: text/plain" https://icanhazdadjoke.com/ | sed -r ':a;N;$!ba;s/\n/<br>/g' | tr -d '\r')"
\```

<pre>echo "::set-env name=TEMP::$(curl -H "Accept: text/plain" https://icanhazdadjoke.com/ | sed -r ':a;N;$!ba;s/\n/<br>/g' | tr -d '\r')"</pre>
<code>echo "::set-env name=TEMP::$(curl -H "Accept: text/plain" https://icanhazdadjoke.com/ | sed -r ':a;N;$!ba;s/\n/<br>/g' | tr -d '\r')"</code>

1. Curabitur vel tempus libero, vitae elementum purus. Cras et enim porttitor, congue odio in, eleifend mi.

    <pre>echo "::set-env name=TEMP::$(curl -H "Accept: text/plain" https://icanhazdadjoke.com/ | sed -r ':a;N;$!ba;s/\n/<br>/g' | tr -d '\r')"</pre>
    <code>echo "::set-env name=TEMP::$(curl -H "Accept: text/plain" https://icanhazdadjoke.com/ | sed -r ':a;N;$!ba;s/\n/<br>/g' | tr -d '\r')"</code>

    ```yml
    - name: Get a dad-joke
      run: |
        echo "::set-env name=TEMP::$(curl -H "Accept: text/plain" https://icanhazdadjoke.com/ | sed -r ':a;N;$!ba;s/\n/<br>/g' | tr -d '\r')"
    ```

2. Curabitur vel tempus libero, vitae elementum purus. Cras et enim porttitor, congue odio in, eleifend mi.

Related Tickets & Documents

Fixes #9988

QA Instructions, Screenshots, Recordings

If there are any instances of <pre> blocks existing inside an <li> are there, a check will be needed to verify their behavior don't get changed. Would also love some feedback on whether it is better to fix this via a custom Renderer or is the CSS fix good? I would love to resend another PR with the renderer fix, albeit after more research on the same if it is the better solution.

Bug:

Bugged image, showing overflow

Fixed:

Fixed image, with no overflow

Added tests?

  • yes
  • no, because they aren't needed
  • no, because I need help

Added to documentation?

  • docs.forem.com
  • readme
  • no documentation needed

[optional] What gif best describes this PR or how it makes you feel?

stopping that leak

- add styling for .highlight to <pre> inside <li>
@pr-triage pr-triage bot added the PR: unreviewed bot applied label for PR's with no review label Oct 11, 2020
Copy link
Contributor

@ludwiczakpawel ludwiczakpawel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one tiny ask, but other than that it seems to be working fine.

app/assets/stylesheets/components/syntax.scss Outdated Show resolved Hide resolved
@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 12, 2020
Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
@pr-triage pr-triage bot added PR: unreviewed bot applied label for PR's with no review and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 12, 2020
@pr-triage pr-triage bot added PR: partially-approved bot applied label for PR's where a single reviewer approves changes and removed PR: unreviewed bot applied label for PR's with no review labels Oct 12, 2020
@pr-triage pr-triage bot added PR: reviewed-approved bot applied label for PR's where reviewer approves changes and removed PR: partially-approved bot applied label for PR's where a single reviewer approves changes labels Oct 12, 2020
@rhymes rhymes merged commit 9b693a8 into forem:master Oct 12, 2020
@pr-triage pr-triage bot added PR: merged bot applied label for PR's that are merged and removed PR: reviewed-approved bot applied label for PR's where reviewer approves changes labels Oct 12, 2020
boardfish pushed a commit to boardfish/forem that referenced this pull request Oct 17, 2020
* fix overflow in list indented code blocks
- add styling for .highlight to <pre> inside <li>

* add `div.highlight` styling to `li blockquote.highlight`

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>

Co-authored-by: ludwiczakpawel <ludwiczakpawel@gmail.com>
Amorpheuz added a commit to Amorpheuz/forem that referenced this pull request Oct 27, 2020
- undos forem#10782
- wraps li codeblocks with `div.highlight`
- wraps pre tags with `div.highlight` in articles
- adds `.highlight` class to pre tags in artricles
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR: merged bot applied label for PR's that are merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing div.highlight in indented code-blocks
3 participants