mdBook icon indicating copy to clipboard operation
mdBook copied to clipboard

Support TSX Syntax Highlighting

Open ericmorgan1 opened this issue 3 years ago • 3 comments

It would be great if mdbook could support TSX syntax highlighting.

Example:

function test(props) {
   const name: string = props.name;
   return (
      <div className="test">Hello, {name}</div>
   );
}

ericmorgan1 avatar Oct 20 '21 22:10 ericmorgan1

I placed a jsx language tag on a code block, and it seems to highlight fine for me:

image

Can you say more about what issue you ran into?

ehuss avatar Oct 24 '21 18:10 ehuss

Hi,

Thank you. Sorry, my original request was not clear, I should have only said "tsx".

jsx would probably work fine, but the slight difference with tsx that I can think of would be type highlighting.

Here is the same code (generated with mdbook) using:

  1. jsx
  2. tsx
  3. typescript

Note the string type.

Screen Shot 2021-10-24 at 3 39 25 PM

ericmorgan1 avatar Oct 24 '21 20:10 ericmorgan1

any updates?

snatvb avatar May 13 '23 10:05 snatvb