ruby.tmbundle | TextMate support for Ruby | Data Migration library
kandi X-RAY | ruby.tmbundle Summary
kandi X-RAY | ruby.tmbundle Summary
TextMate support for Ruby
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ruby.tmbundle
ruby.tmbundle Key Features
ruby.tmbundle Examples and Code Snippets
Community Discussions
Trending Discussions on ruby.tmbundle
QUESTION
I'm trying to syntax-highlight code snippets on my library website. I've tried Highlight.js and Prism, but neither of them tokenize the code correctly (it's Ruby), so in the end the code is not syntax-highlighted properly. This is because they both implement their own tokenization regexes, which is an approach that's bound to have flaws.
I've then discovered that GitHub, Atom and VSCode all use TextMate grammars for their tokenization. This to me sounds like the right approach, to have language grammars maintained in a single place, so that other tools can then reuse them instead of each defining their own.
My question is: how to tokenize a code string using a TextMate grammar in Node? My goal is to have something like:
...ANSWER
Answered 2019-Oct-19 at 12:04After posting my comment I gave it another try and was sucessful this time around. The following example shows how to use vscode-textmate
with the official TypeScript.tmLanguage
but the basics should be applicable to other languages.
- First make sure you have Python 2.7 (not 3.X) installed on your machine and on Windows in your PATH variable.
- Install
vscode-textmate
using npm or yarn which will invoke the required Python interpreter during installation. - Grab your XML grammar (usually ending in
.tmLanguage
) and place it in the project root. - Use the
vscode-textmate
plugin as follows:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ruby.tmbundle
On a UNIX-like operating system, using your system’s package manager is easiest. However, the packaged Ruby version may not be the newest one. There is also an installer for Windows. Managers help you to switch between multiple Ruby versions on your system. Installers can be used to install a specific or multiple Ruby versions. Please refer ruby-lang.org for more information.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page