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

Proper italic/cursive rendering #759

Closed
3 tasks done
HipyCas opened this issue Jun 8, 2022 · 4 comments · Fixed by #777
Closed
3 tasks done

Proper italic/cursive rendering #759

HipyCas opened this issue Jun 8, 2022 · 4 comments · Fixed by #777
Labels
bug Something isn't working theme Related to the theme

Comments

@HipyCas
Copy link

HipyCas commented Jun 8, 2022

Describe the bug

As of now, if you format text as italic/cursive (with either _ or *) it gets transpiled to HTML as an <em> element, instead of <i>. This works in chromium-based browser (as far as I've seen), but for example doesn't show as italic in the latest Firefox versions.

Reproduction

In a Markdown file, wrap any text in a single _ or * (make it cursive), compile and search that text in the page with Firefox.

Expected behavior

Render it to an <i> tag so it is properly formatted in both Chromium-based and Gecko-based (Firefox & others). Alternatively, a CSS could be included by default that formats <em> as italic/cursive.

System Info

System:
  OS: Linux 5.15 Pop!_OS 21.04
  CPU: (8) x64 11th Gen Intel(R) Core(TM) i7-1165G7 @ 2.80GHz
  Memory: 5.75 GB / 15.48 GB
  Container: Yes
  Shell: 5.1.4 - /bin/bash
Binaries:
  Node: 16.4.1 - ~/.nvm/versions/node/v16.4.1/bin/node
  npm: 8.9.0 - ~/.nvm/versions/node/v16.4.1/bin/npm
Browsers:
  Chromium: 102.0.5005.61
  Firefox: 96.0
npmPackages:
  vitepress: ^1.0.0-alpha.1 => 1.0.0-alpha.1

Additional context

No response

Validations

  • Follow our Code of Conduct
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
@HipyCas HipyCas added the bug: pending triage Maybe a bug, waiting for confirmation label Jun 8, 2022
@brc-dd
Copy link
Member

brc-dd commented Jun 9, 2022

Hi! This is a part of the CommonMark Spec. We cannot change the standards. _ or * are not meant for italics, they are for emphasis (although most browsers style the contents as italics). <i> too doesn't mean italics, its "idiomatic text". Quoting MDN:

Typically this element is displayed in italic type. However, it should not be used to apply italic styling; use the CSS font-style property for that purpose.

@brc-dd brc-dd closed this as completed Jun 9, 2022
@brc-dd
Copy link
Member

brc-dd commented Jun 9, 2022

Okay, so this issue is not due to different CSS engine in Firefox. Our italics font is not loading there. Just for test, try setting a different font on em, it will be italics there too. We will fix this. Thanks for the report.

We don't have an italic font face. 😅 In Chrome it works because it falls back to other fonts.

@brc-dd brc-dd reopened this Jun 9, 2022
@brc-dd brc-dd added bug Something isn't working theme Related to the theme and removed bug: pending triage Maybe a bug, waiting for confirmation labels Jun 9, 2022
@brc-dd brc-dd mentioned this issue Jun 9, 2022
3 tasks
@noClaps
Copy link

noClaps commented Jun 9, 2022

Using Chromium on Fedora, italics don't seem to work for me.

@HipyCas
Copy link
Author

HipyCas commented Jun 10, 2022

Thanks for the quick answer @brc-dd! I know that <i> is not meant for italics technically speaking, but it is actually used for it in as far as I know all modern browsers, so that's what I proposed that solution.

Given that the problem lays in the font used, I guess the default font should be changed to support italics by default? I don't believe that people should manually change the font to one with italics support if they want italics.

Also, I would add a CSS to ensure that the <em> element gets proper italic formatting, just in case some browser decides that it isn't going to style it like that.

kiaking pushed a commit that referenced this issue Jun 16, 2022
brc-dd added a commit that referenced this issue Jun 17, 2022
* refactor: refine global layout system

* chore: remove unknown console log from release script

* release: v1.0.0-alpha.2

* docs: add Layer0 deployment notes

Co-authored-by: meteorlxy <[email protected]>

* docs: add cloudflare pages deploy (#797)

close #369 

Co-authored-by: Kia King Ishii <[email protected]>

* refactor: improve site data parsing (#780)

* fix: copy code in non-secure contexts (#792)

Co-authored-by: Divyansh Singh <[email protected]>

* fix(theme): add italic fonts (#759) (#777)

fix #759

* docs: image migration guide for vuepress (#799)

* refactor(types): use built-in utility type `Awaited` (#801)

instead of explicitly defining it. (introduced in TS 4.5)

* feat(theme): support themeable images for logo and hero (#745)

Co-authored-by: Divyansh Singh <[email protected]>

Co-authored-by: Kia King Ishii <[email protected]>
Co-authored-by: Rishi Raj Jain <[email protected]>
Co-authored-by: meteorlxy <[email protected]>
Co-authored-by: Percy Ma <[email protected]>
Co-authored-by: Linmj <[email protected]>
Co-authored-by: JD Solanki <[email protected]>
Co-authored-by: CHOYSEN <[email protected]>
Co-authored-by: Anthony Fu <[email protected]>
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working theme Related to the theme
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants