reddit / emacs

Help needed: Trying to get styled components / gql work in tsx files

IAFalcon · 2022-04-24 14:20
Hey, I'm using doom-emacs and am trying to get syntax highlighting for the most part (I can manage without auto complete) on string literals that stores css / gql, for example this piece of code. const Wrapper = styled.div` width: 24px; height: 24px; margin-right: 14px; cursor: pointer; ` ​ export const schema = gql.gql` type Transaction implements Entity { createdAt: Date createdBy: User entityType: EntityType! fileIds: [ID!]! }` ​ Now I saw some people are using polymode and mmm, I was not able to make it to work properly, I could make it highlight the code but it was not possible to write anything inside the string itself. When I think about this, it's already happening with other languages like org-mode that can show syntax highlighting inside it's code blocks and even on js/ts files when you're doing the following: `this is a template string with a variable ${a == b ? 'this gets syntax highlighting' : 'so why styled cant??'}` Any help would be much appreciated.
__nautilus__ · 2022-04-24 16:34
I have this in my bookmarks. I have tried it yet, so I can’t vouch for it, but I wanted to share in case you find it helpful: https://emacs.stackexchange.com/questions/37918/how-to-highlight-graphql-template-literals-gql-in-jsx-files