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

Different fonts for h1/h2/h3... #16

Closed
cben opened this issue Oct 14, 2013 · 4 comments
Closed

Different fonts for h1/h2/h3... #16

cben opened this issue Oct 14, 2013 · 4 comments

Comments

@cben
Copy link
Owner

cben commented Oct 14, 2013

No description provided.

@cben
Copy link
Owner Author

cben commented Nov 13, 2013

Fixed by 4a9743d, but it wouldn't hurt to check what sizes Latex uses for headings and try to match those.

@cben cben closed this as completed Nov 13, 2013
@cben
Copy link
Owner Author

cben commented Nov 14, 2013

The line-height values I'm using to fake top/bottom margins (which can't be set on a line as long as markdown mode styles spans and not the whole line) are broken:

  • they are arbitrary and probably ugly. cf. http://jerseywebdesigner.com/stylesheet-of-html-header-tags for H1..H6 margins used by browsers.
  • being expressed in ems, they already scale with font-size; decreasing them creates a double effect.
    It'd make sense to have all the same; moreover browsers actually use a reverse progression for H1..H6!
  • if header gets wrapped, line-height causes large spacing between its lines :-(
  • the preffered way to set line-height is a pure number rather than ems.

more reading: http://ux.stackexchange.com/questions/35270/is-there-an-optimal-font-size-line-height-ratio
but line-height can't be the solution.


P.S. Displaying margins on header lines would become unnecessary—even harmful—if they empty lines were required around headers.

Extension: blank_before_header
Standard markdown syntax does not require a blank line before a header. Pandoc does require this (except, of course, at the beginning of the document).

@cben cben reopened this Nov 14, 2013
@cben
Copy link
Owner Author

cben commented Nov 29, 2013

Instead of line-height, could use addLineWidget() to create gaps. But that's ugly and not worth it.
More practically, could set line-height only on the leading # (once separate styling lands in CM) to avoid impacting wrapped lines.
Still leaning towards requiring/encouraging empty lines around headers.

@cben
Copy link
Owner Author

cben commented Jan 7, 2014

Styling .cm-header:first-letter has no effect.
Styling .cm-header:first-line { line-height: 150%; vertical-align: bottom; } almost works (vertical-align is needed to avoid gap between first and second line if header wraps. But math inside headers ignores the alignment (so floats above the line) and interrupts the span so you might have multiple "first" lines.

However styling the <pre> instead of the span (by addLineClass() of 'text' type or token() returning 'line-header') works if I use padding rather than margins:
https://rawgithub.com/cben/CodeMirror/928a487e4ec72b52e2f17c320e13b198ac34cc2e/demo/variableheight.html

cben added a commit that referenced this issue Jan 14, 2014
Drop line-height because it doesn't work well with wrapped headers and there is a better fix (see #16).
@cben cben closed this as completed in 2197d63 Jan 14, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant