Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: template README headings other than h2 render as body text #29232

Description

@aslafy-z

Summary

On the template Docs tab (/templates/<name>/docs), only <h2> headings in the rendered README are styled. <h1>, <h3> and below render at body size and weight, so a README that starts with # Title shows the title as a plain paragraph, and ### sections are indistinguishable from the text around them.

Steps to reproduce

  1. Push a template whose README.md is:

    ---
    display_name: Example
    ---
    
    # Example
    
    Intro paragraph.
    
    ## Section
    
    ### Subsection
  2. Open the template's Docs tab.

Expected

# Example is visibly larger than ## Section, which is larger than ### Subsection.

Actual

# Example and ### Subsection look like the intro paragraph. Only ## Section is rendered as a heading.

Cause

Tailwind preflight resets every heading to font-size: inherit; font-weight: inherit. site/src/index.css only restores h2 (font-size: 1.5em; font-weight: bold); h1, h3 and h4 get margins only:

https://github.com/coder/coder/blob/main/site/src/index.css#L769-L787

markdownClassName in site/src/components/Markdown/Markdown.tsx sets heading margins and line-height but no sizes either.

Suggested fix

Give the Markdown component a heading scale (for example [&_h1]:text-2xl [&_h1]:font-bold [&_h3]:text-lg [&_h3]:font-semibold, and so on), or restore sizes for every heading level in index.css next to the existing h2 rule.

Workaround

Only use h2s.

Environment

  • Coder v2.37.1+22f4284
  • Chrome, Linux

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions