https://github.com/paul-go/truth-syntax-highlighter
Syntax highlighting for the Truth language
https://github.com/paul-go/truth-syntax-highlighter
highlighting javascript language module node syntax truth typescript
Last synced: 3 months ago
JSON representation
Syntax highlighting for the Truth language
- Host: GitHub
- URL: https://github.com/paul-go/truth-syntax-highlighter
- Owner: paul-go
- Created: 2019-02-27T02:26:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2019-03-09T17:37:51.000Z (about 6 years ago)
- Last Synced: 2025-01-12T11:33:28.606Z (4 months ago)
- Topics: highlighting, javascript, language, module, node, syntax, truth, typescript
- Language: TypeScript
- Size: 4.88 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Truth Syntax Highlighter
This is a syntax highlighting utility for Truth. It uses the Truth compiler to parse Truth code, and emits an HTML representation of the code that can be styled with CSS.
## Installation
```
npm install truth-syntax-highlighter --save
```If you're using TypeScript, you can add typings for the highlighter by modifying your `tsconfig.json` to look like this:
```
{
"compilerOptions": {
...
"types": ["truth-syntax-highlighter"]
}
}
```## Usage
```typescript
import { Highlighter } from "truth-syntax-highlighter";const sourceText = `
// Truth code goes here
`;const indentString = "\t";
const truthHtmlText = Highlighter.toHtml(sourceText, indentString);
```The emitted code contains no CSS styling, only class names that allow you to do so. There is a template CSS file included in this repo that you may use to style the code.