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

Code Syntax Theming #36

Open
rafegoldberg opened this issue May 3, 2020 · 0 comments
Open

Code Syntax Theming #36

rafegoldberg opened this issue May 3, 2020 · 0 comments

Comments

@rafegoldberg
Copy link
Contributor

Technical documentation features a lot of code blocks. We already allow authors to customize the base background and text colors for code blocks. We should extend this support to the complete syntax highlighting theme.

CSS-Based Themes

Using syntax selectors & highlight variables to override the default theme:

.markdown-body pre .cm {
  &-node        {  color:  var(--md-syntax-string,     #9c3328)  }
  &-tag         {  color:  var(--md-syntax-string,     #9c3328)  }
  &-string      {  color:  var(--md-syntax-string,     #b35e14)  }
  &-number      {  color:  var(--md-syntax-number,     #75438a)  }
  &-property    {  color:  var(--md-syntax-property,   #1d75b3)  }
  &-keyword     {  color:  var(--md-syntax-keyword,    #1d75b3)  }
  &-qualifier   {  color:  var(--md-syntax-qualifier,  #047d65)  }
  &-variable    {  color:  var(--md-syntax-var,        #047d65)  }
  &-variable-2  {  color:  var(--md-syntax-var-alt,    #ffffff)  }
  &-comment     {  color:  var(--md-syntax-comment,    #75787b)  }
  &-atom        {  color:  var(--md-syntax-atom,       #75438a)  }
  &-operator    {  color:  var(--md-syntax-operator,   #ffffff)  }
  &-def         {  color:  var(--md-syntax-def,        #ffffff)  }
}
Issues
  • lots of manual Custom CSS config required (still, it's better than some of the crazy things I've seen done to get this working though!)
  • will revert to default theme in older browsers (without a polyfill at least!)
@rafegoldberg rafegoldberg transferred this issue from readmeio/api-explorer Aug 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant