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

Support TSX Syntax Highlighting #1674

Open
ericmorgan1 opened this issue Oct 20, 2021 · 3 comments
Open

Support TSX Syntax Highlighting #1674

ericmorgan1 opened this issue Oct 20, 2021 · 3 comments
Labels
A-Highlighting Area: Code colored syntax highlighting

Comments

@ericmorgan1
Copy link

ericmorgan1 commented Oct 20, 2021

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>
   );
}
@ehuss ehuss added the A-Highlighting Area: Code colored syntax highlighting label Oct 24, 2021
@ehuss
Copy link
Contributor

ehuss commented Oct 24, 2021

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?

@ericmorgan1
Copy link
Author

ericmorgan1 commented Oct 24, 2021

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 ericmorgan1 changed the title Support JSX Syntax Highlighting Support TSX Syntax Highlighting Oct 24, 2021
@snatvb
Copy link

snatvb commented May 13, 2023

any updates?

ehuss added a commit to ehuss/mdBook that referenced this issue May 13, 2023
This updates highlight.js to 10.7.3, which picks up various syntax highlighting fixes.
This is keeping on the 10.x release due to rust-lang#1622.

I have also added a few requested languages: abnf

Note that there is a new deprecation in this release. I haven't updated the javascript code to avoid breaking any projects which just override highlight.js in their theme. Unfortunately this will result in a deprecation warning in the console, which can't easily be turned off.

Closes rust-lang#1344
Closes rust-lang#1674
@ehuss ehuss mentioned this issue Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Highlighting Area: Code colored syntax highlighting
Projects
None yet
Development

No branches or pull requests

3 participants