Skip to content

Commit

Permalink
render URLs in terminal output using xterm-addon-web-links (#59)
Browse files Browse the repository at this point in the history
* render URLs in terminal output using xterm-addon-web-links

* Update xtermjs

---------

Co-authored-by: Reilly Grant <[email protected]>
  • Loading branch information
Kriechi and reillyeon authored Aug 31, 2023
1 parent d9bf6a1 commit fbb258a
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 16 deletions.
43 changes: 29 additions & 14 deletions package-lock.json

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

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
"dependencies": {
"@types/w3c-web-serial": "^1.0.3",
"web-serial-polyfill": "^1.0.14",
"xterm": "^5.0.0",
"xterm-addon-fit": "^0.6.0"
"xterm": "^5.2.1",
"xterm-addon-fit": "^0.7.0",
"xterm-addon-web-links": "^0.8.0"
},
"devDependencies": {
"@types/web": "0.0.71",
Expand Down
5 changes: 5 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import {Terminal} from 'xterm';
import {FitAddon} from 'xterm-addon-fit';
import {WebLinksAddon} from 'xterm-addon-web-links';
import 'xterm/css/xterm.css';
import {
serial as polyfill, SerialPort as SerialPortPolyfill,
Expand Down Expand Up @@ -52,8 +53,12 @@ const bufferSize = 8 * 1024; // 8kB
const term = new Terminal({
scrollback: 10_000,
});

const fitAddon = new FitAddon();
term.loadAddon(fitAddon);

term.loadAddon(new WebLinksAddon());

const encoder = new TextEncoder();
let toFlush = '';
term.onData((data) => {
Expand Down

0 comments on commit fbb258a

Please sign in to comment.