Skip to content

Commit

Permalink
Fix for issue #51
Browse files Browse the repository at this point in the history
Plus other updates as we prepare for NPM release
  • Loading branch information
drudru committed Feb 6, 2019
1 parent a348ad2 commit dc92bdc
Show file tree
Hide file tree
Showing 10 changed files with 164 additions and 560 deletions.
3 changes: 0 additions & 3 deletions Makefile
Expand Up @@ -5,9 +5,6 @@ REPORTER = dot

typescript:
./node_modules/.bin/tsc -p .
cat ./umd.header ./dist/ansi_up.js ./umd.footer > ansi_up.js
mv ./dist/ansi_up.js ./dist/ansi_up.js.include
node ./scripts/fix-typings.js

test:
@NODE_ENV=test ./node_modules/.bin/mocha \
Expand Down
3 changes: 2 additions & 1 deletion Readme.md
Expand Up @@ -74,6 +74,7 @@ More examples are in the 'examples' directory in the repo.

## Versions

* Version 4.0 - Re-architect code to support terminal linkify escapes.
* Version 3.0 - now treats ANSI bold sequences as CSS font-weight:bold
* Version 2.0 - moved to a stateful, streaming version of the API
* Version 1.3 - was the last of the older, deprecated API.
Expand All @@ -99,7 +100,7 @@ This function only interprets ANSI SGR (Select Graphic Rendition) codes that can

The default style uses colors that are very close to the prescribed standard. The standard assumes that the text will have a black background. These colors are set as inline styles on the SPAN tags. Another option is to set 'use_classes: true' in the options argument. This will instead set classes on the spans so the colors can be set via CSS. The class names used are of the format ````ansi-*-fg/bg```` and ````ansi-bright-*-fg/bg```` where * is the colour name, i.e black/red/green/yellow/blue/magenta/cyan/white. See the examples directory for a complete CSS theme for these classes.

#### ansi_to_text (txt)
#### ansi_to_text (txt) DEPRECATED

This simply removes the ANSI escape codes from the stream.
No escaping is done.
Expand Down
8 changes: 4 additions & 4 deletions dist/ansi_up.d.ts → ansi_up.d.ts
@@ -1,8 +1,8 @@
export interface AU_Color {
interface AU_Color {
rgb: number[];
class_name: string;
}
export interface TextWithAttr {
interface TextWithAttr {
fg: AU_Color;
bg: AU_Color;
bold: boolean;
Expand All @@ -17,12 +17,12 @@ declare enum PacketKind {
SGR = 5,
OSCURL = 6
}
export interface TextPacket {
interface TextPacket {
kind: PacketKind;
text: string;
url: string;
}
export default class AnsiUp {
declare class AnsiUp {
VERSION: string;
private ansi_colors;
private palette_256;
Expand Down
296 changes: 149 additions & 147 deletions ansi_up.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions ansi_up.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions ansi_up.ts
Expand Up @@ -50,7 +50,7 @@ interface TextPacket {

class AnsiUp
{
VERSION = "4.0.0";
VERSION = "4.0.1";

//
// *** SEE README ON GITHUB FOR PUBLIC API ***
Expand Down Expand Up @@ -688,7 +688,7 @@ class AnsiUp
if (! this._url_whitelist[parts[0]])
return '';

let result = `<a href="${pkt.url}">${this.escape_txt_for_html(pkt.text)}</a>`;
let result = `<a href="${this.escape_txt_for_html(pkt.url)}">${this.escape_txt_for_html(pkt.text)}</a>`;
return result;
}
}
Expand Down

0 comments on commit dc92bdc

Please sign in to comment.