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

Added initial LaTeX support #316

Merged
merged 2 commits into from
Aug 8, 2014
Merged

Added initial LaTeX support #316

merged 2 commits into from
Aug 8, 2014

Conversation

japborst
Copy link

@japborst japborst commented Aug 6, 2014

Rebased version of pull #207 on issue #206

@japborst japborst mentioned this pull request Aug 6, 2014
@LeaVerou
Copy link
Member

LeaVerou commented Aug 6, 2014

Is there anyone here that actually knows LaTeX to review this?

'comment': /%[\w\W]*/g,
'string': /(\$)(\\?.)*?\1/g,
'punctuation': /[\{\}]/g,
'selector': /[\\][a-zA-Z;,:\.]*/g
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • A character class with only 1 character is pointless, just use \\ instead of [\\]
  • You can avoid a-zA-Z by using the i flag to make it case insensitive

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also [\w\W]* will match the whole file, but Latex uses one line comments. It should be something like: 'comment': /%.*?(\r?\n|$)/g,

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or you can use the m flag and add a $ so that it only matches the line

@japborst
Copy link
Author

japborst commented Aug 8, 2014

Thanks for the suggestions!

I merged that into the files now. Ran it just now on some massive files we used for our graduation project and everything seemed to be highlighted just fine.

LeaVerou added a commit that referenced this pull request Aug 8, 2014
Added initial LaTeX support
@LeaVerou LeaVerou merged commit 5f66140 into PrismJS:gh-pages Aug 8, 2014
@LeaVerou
Copy link
Member

LeaVerou commented Aug 8, 2014

Merged, thanks :)
A minified file would be nice too :)

@apfelbox
Copy link
Contributor

apfelbox commented Aug 8, 2014

I just pushed the minified version.

@LeaVerou
Copy link
Member

LeaVerou commented Aug 8, 2014

Thanks Jannik!

@japborst
Copy link
Author

Awesome. Thanks both :)

@Golmote Golmote mentioned this pull request Dec 13, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants