MacDownApp / MacDownApp/macdown

Adding MathJax increases first element's top margin (Github themes)

Open
#305 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rich Text Format
Stars
9.8k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

It seems that when MathJax is enabled, this selector in GitHub2 (and a similar one in GitHub) stop working:

``` css
body > *:first-child {
margin-top: 0 !important; }
```

So the first heading of the document ends up with excess top margin. I'm guessing this is because MathJax script tags are being injected right after `` before the actual document. Perhaps it can be loaded in the `` instead?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the GitHub2 and GitHub theme CSS rules containing `body > *:first-child`, then check how MathJax script tags are inserted relative to ``. Confirm the fix by rendering a document with MathJax enabled and verifying that its first heading has no excess top margin.

Written by the indexing model from the issue text.

Assessment

Tech stack
css
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.