From 83ce64dd2ce2e7f61e1eceab9ebddef81c3ebe6e Mon Sep 17 00:00:00 2001 From: pro-src Date: Tue, 22 May 2018 22:48:40 -0500 Subject: [PATCH 1/5] Add gulp task to generate docs via typedoc --- .gitignore | 6 +++ _config.yml | 4 ++ gulpfile.js | 126 +++++++++++++++++++++++++++++++++++++++++++++++++++ package.json | 20 ++++++++ 4 files changed, 156 insertions(+) create mode 100644 gulpfile.js create mode 100644 package.json diff --git a/.gitignore b/.gitignore index 45c1505..651505f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,9 @@ _site .sass-cache .jekyll-metadata + +# Node.js +package-lock.json +node_modules/ + +xterm.js/ diff --git a/_config.yml b/_config.yml index 3d50df8..349b002 100644 --- a/_config.yml +++ b/_config.yml @@ -15,6 +15,10 @@ defaults: include: - _pages +exclude: + - gulpfile.js + - package.json + collections: docs: output: true diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..b36dca3 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,126 @@ +/** + * Copyright (c) 2018 The xterm.js authors. All rights reserved. + * @license MIT + */ + +const gulp = require('gulp'); +const typedoc = require('gulp-typedoc'); +const fs = require('fs-extra'); +const path = require('path'); + +gulp.task('docs:clean', async function() { + const directory = path.join(__dirname, '_docs/api/terminal'); + if (await fs.pathExists(directory)) { + await fs.remove(directory); + } +}) + +/** + * Generate TypeScript project markdown + */ +gulp.task('docs:build', ['docs:clean'], function() { + return gulp.src('./xterm.js/typings/xterm.d.ts') + .pipe(typedoc({ + // TypeScript options (see typescript docs) + module: 'commonjs', + target: 'es5', + + // Output options (see typedoc docs) + out: './_docs/api/terminal/', + // Required to process .d.ts files + includeDeclarations: true, + // Exclude @types/node, etc. + excludeExternals: true, + // Excludes private class members + excludePrivate: true, + // The branch or revision that will be used to create src links + gitRevision: 'master', + + // TypeDoc options (see typedoc docs) + readme: 'none', + theme: 'markdown', + ignoreCompilerErrors: false + })); +}); + +/** + * This task works around the following issues: + * + * _docs/api/terminal/README.md only contains a link to + * _docs/api/terminal/modules/_xterm_d_.md + * + * _docs/api/terminal/modules/_xterm_d_.md only contains a link to + * _docs/api/terminal/modules/_xterm_d_._xterm_.md + * + * The nearly empty files are removed and + * _docs/api/terminal/modules/_xterm_d_._xterm_.md is moved to + * _docs/api/terminal/index.md + * + * Links are modified to reflect these changes. + * @TODO: Some interfaces are too verbose and should be simplified + */ +gulp.task('docs:patch', ['docs:build'], async function() { + const docs = (...args) => + path.join(__dirname, '_docs/api/terminal', ...args); + + // Remove unnecessary files + await fs.remove(docs('README.md')); + await fs.remove(docs('modules/_xterm_d_.md')); + + // Regex to match filenames that should be replaced with index.md + const filenames = /(readme\.|(modules\/)?(_xterm_(d_)?\.)+)md(?=#|$)/i; + + // All of the files that need to be updated are in subdirs + for (const dirname of await fs.readdir(docs())) { + const directory = docs(dirname); + for (const basename of await fs.readdir(directory)) { + const document = path.join(directory, basename); + // Match markdown links i.e. [name](../some/relative/file) + const re = /\[([^\[\]]*)\]\(([^()]*)\)/g; + + let data = await fs.readFile(document, 'utf-8'); + let modified = false; + let match; + + if (basename === '_xterm_d_._xterm_.md') { + // Remove the navigation links from the index document + data = data.substring(data.indexOf('\n') + 1); + modified = true; + } + + while ((match = re.exec(data)) !== null) { + let [link, title, uri] = match; + let replacement = ''; + + if (/_xterm_(d_)?\.md(#|$)/.test(uri) && + data.substring(re.lastIndex, re.lastIndex + 3) === ' > ') { + // Remove the navigation link and the angle bracket that follows + re.lastIndex += 3; + } + else if (filenames.test(uri)) { + uri = uri.replace(filenames, 'index.md'); + replacement = `[${title}](${uri})`; + } + else { + continue; + } + + data = data.substr(0, match.index) + replacement + + data.substr(re.lastIndex); + re.lastIndex = match.index + replacement.length; + modified = true; + } + + if (modified) { + await fs.writeFile(document, data, 'utf-8'); + } + } + } + + // Move the main markdown document to ./_docs/api/terminal/index.md + await fs.move(docs('modules/_xterm_d_._xterm_.md'), + docs('index.md')); +}); + +gulp.task('docs', ['docs:patch']); +gulp.task('default', ['docs']); diff --git a/package.json b/package.json new file mode 100644 index 0000000..40bff66 --- /dev/null +++ b/package.json @@ -0,0 +1,20 @@ +{ + "private": true, + "name": "xtermjs.org", + "description": "", + "version": "0.0.1", + "main": "N/A", + "repository": "https://github.com/xtermjs/xtermjs.org", + "license": "MIT", + "scripts": { + "build:docs": "gulp docs" + }, + "dependencies": { + "@types/node": "^6.0.108", + "fs-extra": "^6.0.1", + "gulp": "^3.9.1", + "gulp-typedoc": "^2.2.0", + "typedoc": "^0.11.1", + "typedoc-plugin-markdown": "^1.1.11" + } +} From 4104182d656434843f1522dd4a38d03a68125069 Mon Sep 17 00:00:00 2001 From: pro-src Date: Tue, 22 May 2018 23:07:33 -0500 Subject: [PATCH 2/5] Add CI scripts to auto-update docs --- .travis.yml | 8 +++++ _config.yml | 1 + bin/trigger-build | 52 ++++++++++++++++++++++++++++ bin/update-docs | 88 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 149 insertions(+) create mode 100644 .travis.yml create mode 100755 bin/trigger-build create mode 100755 bin/update-docs diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5881960 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,8 @@ +language: node_js +os: linux +node_js: + - 'lts/*' +before_install: npm i -g npm@6 +notifications: + email: false +script: bin/update-docs diff --git a/_config.yml b/_config.yml index 349b002..3d456b5 100644 --- a/_config.yml +++ b/_config.yml @@ -18,6 +18,7 @@ include: exclude: - gulpfile.js - package.json + - bin/ collections: docs: diff --git a/bin/trigger-build b/bin/trigger-build new file mode 100755 index 0000000..31e4c08 --- /dev/null +++ b/bin/trigger-build @@ -0,0 +1,52 @@ +#!/bin/bash + +# Copyright (c) 2018 The xterm.js authors. All rights reserved. +# @license MIT + +# This script is used to conditionally chain CI builds. + +# References: +# https://docs.travis-ci.com/user/deployment/script/ +# https://docs.travis-ci.com/user/deployment#Deploying-to-Multiple-Providers +# https://docs.travis-ci.com/user/triggering-builds/ + +# The target github repository and branch +REPO_SLUG="${1:-xtermjs/xtermjs.org}" +BRANCH="${2:-master}" +# The CI build message +MESSAGE="${3:-Update for xterm.js v$TRAVIS_TAG}" + +# The following .travis.yml shows the idea way of calling this script. +# path="$REPO_SLUG/$BRANCH/bin/trigger-build" +# +# deploy: +# - provider: script +# script: curl -L https://raw.githubusercontent.com/$path | bash +# on: +# tags: true +# branch: master + +if [ -z $TRAVIS_TOKEN ]; then + echo "Missing required environment variable: TRAVIS_TOKEN" + exit 1 +fi + +# Escape the forward slash i.e. "/" => "%2F" +slug="${REPO_SLUG/\//%2F}" +body=`cat << EOF +{ + "request": { + "message": "$MESSAGE", + "branch": "$BRANCH" + }, +} +EOF +` +# Request a build of the last commit to $BRANCH +curl -s -X POST \ + -H "Content-Type: application/json" \ + -H "Accept: application/json" \ + -H "Travis-API-Version: 3" \ + -H "Authorization: token $TRAVIS_TOKEN" \ + -d "$body" \ + "https://api.travis-ci.org/repo/${slug}/requests" diff --git a/bin/update-docs b/bin/update-docs new file mode 100755 index 0000000..70b8754 --- /dev/null +++ b/bin/update-docs @@ -0,0 +1,88 @@ +#!/bin/bash + +# Copyright (c) 2018 The xterm.js authors. All rights reserved. +# @license MIT + +# ~* SECURITY NOTICE *~ +# Do not source this script! +# Do not rely on CI's attempt to hide sensitive output! + +set -e +set +x + +git clone --recursive https://github.com/xtermjs/xterm.js +TAG=$(cd xterm.js && git describe --tags) + +npm run build:docs + +# This function should remain CI-agnostic to avoid tight integrations +update() { + if [[ $TAG =~ ^([0-9]\.){2}[0-9] ]]; then + local version="$BASH_REMATCH" + else + echo "Skipping update: unknown xterm.js repo tag format (${TAG})" + return 0 + fi + if [ -z $GH_TOKEN ]; then + echo "Aborting update: missing github token" + return 1 + fi + + local repo_slug="${1:-xtermjs/xtermjs.org}" + local branch="${2:-master}" + local remote="https://$GH_TOKEN@github.com/${repo_slug}.git" + + echo "Updating ${branch}..." + + # If a specific commit was checked out, we're in a detached head state + # Ensure git is configured to checkout master + git config remote.origin.fetch +refs/heads/*:refs/remotes/origin/* + git fetch --tags + + # Checkout master and perform version check + git checkout ${branch} + if git rev-list "docs-$version" > /dev/null 2>&1; then + echo "Skipping update: docs are up to date with xterm.js v$version" + return 0 + fi + + # Add docs, and commit + git add _docs/api/terminal/ + git config --global user.email "${COMMIT_EMAIL:-ci-name@ci.tld}" + git config --global user.name "${COMMIT_USER:-ci-name}" + git commit -m "${COMMIT_MESSAGE:-Update docs: build ID [skip ci]}" + git tag docs-$version + + # Push to Github - Security Note: redirect stderr and stdout to /dev/null + git remote add deploy ${remote} > /dev/null 2>&1 + git push --follow-tags --quiet --set-upstream deploy ${branch} +} + +# This script ignores PR, non-master branch, unknown CI, and scheduled builds. +# It will only call update for builds triggered by API. See AppVeyor notes... +# Travis and AppVeyor respect the [skip ci] commit message. The additional +# check is to account for potential CI bugs. +if [ "$CI" = "true" -o "$CONTINOUS_INTEGRATION" = "true" ]; then + if [ "$TRAVIS" = "true" ] && \ + [ "$TRAVIS_EVENT_TYPE" = "api" ] && \ + [ "$TRAVIS_PULL_REQUEST" != "true" ] && \ + [ "$TRAVIS_BRANCH" = "master" ] && \ + [[ $TRAVIS_COMMIT_MESSAGE != *\[skip\ ci\]* ]]; then + COMMIT_EMAIL="travis@travis-ci.org" + COMMIT_USER="Travis CI" + COMMIT_MESSAGE="Update docs to $TAG: $TRAVIS_BUILD_ID [skip ci]" + update + elif [ "$APPVEYOR" = "true" -a "$APPVEYOR_REPO_PROVIDER" = "github" ] && \ + [ -z "$APPVEYOR_PULL_REQUEST_NUMBER" ] && \ + [ "APPVEYOR_SCHEDULED_BUILD" != "true" ] && \ + [ "$APPVEYOR_REPO_BRANCH" = "master" ] && \ + [[ $APPVEYOR_REPO_COMMIT_MESSAGE != *\[skip\ ci\]* ]]; then + # AppVeyor can ignore all commits and build only for API calls + # by using `skip_commits.message` with an always true regex i.e. /*/ + # https://www.appveyor.com/docs/how-to/filtering-commits/ + COMMIT_EMAIL="appveyor@appveyor.com" + COMMIT_USER="AppVeyor" + COMMIT_MESSAGE="Update docs to $TAG: $APPVEYOR_BUILD_ID [skip ci]" + update + fi +fi From a0e2117819c3ec567bc23e23580442b3260bb85b Mon Sep 17 00:00:00 2001 From: pro-src Date: Thu, 24 May 2018 20:18:43 -0500 Subject: [PATCH 3/5] Update docs --- _docs/api/Terminal.md | 416 ------- _docs/api/terminal/classes/terminal.md | 1052 +++++++++++++++++ _docs/api/terminal/interfaces/idisposable.md | 43 + .../api/terminal/interfaces/ieventemitter.md | 103 ++ .../interfaces/ilinkmatcheroptions.md | 145 +++ .../interfaces/ilocalizablestrings.md | 53 + _docs/api/terminal/interfaces/imarker.md | 75 ++ .../terminal/interfaces/iterminaloptions.md | 311 +++++ _docs/api/terminal/interfaces/itheme.md | 277 +++++ _docs/api/terminal/modules/xterm.md | 50 + 10 files changed, 2109 insertions(+), 416 deletions(-) delete mode 100644 _docs/api/Terminal.md create mode 100644 _docs/api/terminal/classes/terminal.md create mode 100644 _docs/api/terminal/interfaces/idisposable.md create mode 100644 _docs/api/terminal/interfaces/ieventemitter.md create mode 100644 _docs/api/terminal/interfaces/ilinkmatcheroptions.md create mode 100644 _docs/api/terminal/interfaces/ilocalizablestrings.md create mode 100644 _docs/api/terminal/interfaces/imarker.md create mode 100644 _docs/api/terminal/interfaces/iterminaloptions.md create mode 100644 _docs/api/terminal/interfaces/itheme.md create mode 100644 _docs/api/terminal/modules/xterm.md diff --git a/_docs/api/Terminal.md b/_docs/api/Terminal.md deleted file mode 100644 index 3c69507..0000000 --- a/_docs/api/Terminal.md +++ /dev/null @@ -1,416 +0,0 @@ ---- -title: Terminal -category: API -layout: docs ---- - -`Terminal` is the main class of xterm.js. It is used to construct terminal objects and allow programmatic manipulation of them. - -```javascript -var term = new Terminal(); - -// Exposes the terminal in an existing DOM object. -term.open(document.getElementById('xterm-container')); -``` - -## Constructor - -Create a new terminal by using the `Terminal([options])` constructor. - -### Options - -#### `cursorBlink` (boolean) - -Whether the terminal cursor blinks - -#### `cols` (number) - -The number of columns of the terminal (horizontal size). - -#### `rows` (number) - -The number of rows of the terminal (vertical size). - -#### `scrollback` (number) - -The number of rows to be persisted in terminal buffer for scrolling (default: `1000`). - -#### `tabStopWidth` (number) - -The number of columns a tab stop should occupy (default: `8`). - -### Example - -```javascript -var term = new Terminal({ - cursorBlink: false, // Do not blink the terminal's cursor - cols: 120, // Set the terminal's width to 120 columns - rows: 80 // Set the terminal's height to 80 rows -}); -``` - -## Attributes - -### `element` - -The DOM element that hosts the terminal. - -```javascript -// Log the class(es) of the terminal's host element -console.log(term.element.classList); -``` - -### `textarea` - -The textarea element of the terminal that controls all input. - -```javascript -// Log the keyCode of every keyDown event -term.textarea.onkeydown = function (e) { - console.log('User pressed key with keyCode: ', e.keyCode); -} -``` - - -## Methods - -### `attachCustomKeyEventHandler(customKeydownHandler)` - -- `customKeydownHandler` - Function - The custom KeyboardEvent handler to attach. - -Attach a custom key event handler to allow consumers to allow certain key strokes -to skip processing by the terminal. Return false to prevent xterm.js from -processing the key event. - -```javascript -// Completely ignore the `Tab` key using a custom key event handler. -term.attachCustomKeyEventHandler(function (e) { - if (e.keyCode == 9) { - // Do nothing - return false; - } -}); -``` - -### `blur` - -Remove the focus from the terminal. - -```javascript -term.blur(); -``` - -### `clear` - - Clears the entire buffer of the terminal, making the prompt line the new first line. - -```javascript -term.clear(); -``` - -### `clearSelection` - -Clears the current terminal selection. - -```javascript -term.clearSelection(); -``` - -### `destroy` - - Destroys the terminal and detaches it from the DOM. - -```javascript -term.destroy(); -``` - -### `focus` - -Focus on the terminal - -```javascript -term.focus(); -``` - -### `getOption(key)` - -- `key` - String - The option key - -Retrieves an option from the terminal. - -```javascript -var doesTheTerminalCursorBlink = term.getOption('cursorBlink'); -``` - -### `getSelection` - -Gets the terminal's current selection, this is useful for implementing copy behavior outside of xterm.js. - -```javascript -console.log('Selection: ' + term.getSelection()); -``` - -### `hasSelection` - -Gets whether the terminal has an active selection. - -```javascript -if (term.hasSelection()) { - term.clearSelection(); -} -``` - -### `applyAddon(addon)` *(static method)* - -- `addon` - Object - The addon to apply on the `Terminal` constructor - -> **Attention!** This is a static method, since it extends the basic `Terminal` prototype and not a single `Terminal` instance. - -```javascript -import { Terminal } from './xterm'; -import * as fit from './xterm/lib/addons/fit/fit'; - -Terminal.applyAddon(fit); - -var term = new Terminal(); - -term.open(document.getElementById('#terminal')); -term.fit(); // The `fit` method is now available for usage, since we applied the `fit` addon. -``` - -### `on(event, callback)` - -- `event` - string - The event to attach the callback -- `callback` - Function - The callback to run on the event - -Attach a callback to run on a specific event. - -```javascript -function logResize(size) { - console.log('Resized to ' + size.cols + ' cols and ' + size.rows + ' rows.'); -} - -// Log the terminal's size when it gets resized. -term.on('resize', logResize) -``` - -### `off(event, callback)` - -- `event` - string - The event from which to detach the callback -- `callback` - Function - The callback to stop running on the event - -Stop running a callback on an event. - -```javascript -// Stop logging the terminal's size when it gets resized. -term.off('resize', logResize) -``` - -### `open(parent, focus)` - -- `parent` - HTMLElement - The DOM element to host the terminal -- `focus` - Boolean - Focus the terminal, after it gets instantiated in the DOM - -Open the terminal into the given parent element. The parent element should be visible (have dimensions) when `open` is called as several DOM-based measurements need to be performed when this function is called. - -> ⚠️ The `focus` argument currently defaults to `true` but starting with xterm.js 3.0 it will default to `false`. - -```javascript -var terminalParent = document.getElementById('xterm-container'); - -// Expose the terminal into `terminalParent`. -term.open(terminalParent, false); -``` - -### `refresh(start, end, queue)` - -- `start` - Number - The first row to be refreshed -- `end` - Number - The last row to be refreshed -- `queue` - Boolean - Queue the refresh to run asynchronously, when it's more optimal - -Refresh (re-render) the terminal content between two rows (inclusive). - -```javascript -var terminalParent = document.getElementById('xterm-container'); - -// Refresh the contents of the terminal from the 10th to the 20th line. -term.refresh(10, 20); -``` - -### `reset()` - -Reset the terminal; reconstruct the instance and re-render the whole buffer. - -```javascript -term.reset(); -``` - -### `resize(x, y)` - -- `x` - Number - The number of columns to set to the terminal -- `y` - Number - The number of rows to set to the terminal - -Resize the geometry of the terminal. - -```javascript -// Set the terminal to 120 columns wide and 80 rows tall -term.resize(120, 80); -``` - -### `scrollDisp(n)` - -- `n` - Number - The number of rows to scroll down (or up if negative) - -Scroll the terminal by a number of lines. - -```javascript -// Scroll the terminal down by 5 rows -term.scrollDisp(5); - -// Then scroll up to the previous position -term.scrollDisp(-5); -``` - -### `scrollPages(n)` - -- `n` - Number - The number of pages to scroll down (or up if negative) - -Scroll the terminal by a number of pages. - -```javascript -// Scroll the terminal down 1 page -term.scrollDisp(1); - -// Then scroll up to the previous position -term.scrollDisp(-1); -``` - -### `scrollToTop()` - -Scrolls the terminal to the top of the buffer. - -```javascript -term.scrollToTop(); -``` - -### `scrollToBottom()` - -Scrolls the terminal to the bottom of the buffer. - -```javascript -term.scrollToBottom(); -``` - -### `selectAll` - -Selects all text within the terminal. - -```javascript -term.selectAll(); -``` - -### `setOption(key, value)` - -- `key` - String - The option key -- `value` - The option value - -Sets an option on the terminal. - -```javascript -term.setOption('cursorBlink', true); -``` - -### `write(text)` - -- `text` - String - The text to write to the terminal. - -Writes the given text to the terminal. - -```javascript -// Writes "Hello World!" in the terminal. -term.write('Hello World!') -``` - -### `writeln(text)` - -- `text` - String - The text to write to the terminal. - -Writes the given text to the terminal, followed by a line break (`\n`). - -```javascript -// Writes "Hello World!\n" in the terminal. -term.writeln('Hello World!') -``` - - -## Events - -The `Terminal` instances emit the following events. - -You can listen to an event with the [`on`](#onevent-callback) method and -stop listening to an event with the [`off`](#onevent-callback) method. - -### `blur` - -Emitted when the terminal blurs (loses focus). - -### `data` - -- `data` - String - The data to be handled by the terminal - -Emitted when a chunk of data is being dispatched to the terminal for handling. - -### `focus` - -Emitted when the terminal gets focus. - -### `key` - -- `key` - String - The key that got handled -- `e` - KeyboardEvent - The original `keydown` or `keypress` event - -Emitted when the terminal handles a keydown or keypress event. - -### `keydown` - -- `e` - KeyboardEvent - The original `keydown` - -Emitted after a `keydown` event on the terminal. - -### `keypress` - -- `e` - KeyboardEvent - The original `keypress` - -Emitted after a `keypress` event on the terminal. - -### `linefeed` - -Emitted when the terminal gets a line feed or new line character. - -### `open` - -Emitted when the terminal gets opened in a DOM element. - -### `refresh` - -- `data` - Object - `{element: this.element, start: start, end: end}` - -Emitted when the terminal gets a content refresh (re-render). - -### `resize` - -- `data` - Object - `{terminal: this, cols: x, rows: y}` - -Emitted when the terminal gets resized to a new geometry. - -### `scroll` - -- `ydisp` - Number - The number of rows the terminal scrolled down (or up if negative). - -Emitted when the terminal scrolls vertically. This event can be emitted manually to synchronize the scroll bar, this is useful if the terminal was resized while it was `display: none`. - -### `title` - -- `title` - String - The title of the terminal - -Emitted when the terminal's title get updated via the [appropriate xterm escape sequence](http://tldp.org/HOWTO/Xterm-Title-3.html). diff --git a/_docs/api/terminal/classes/terminal.md b/_docs/api/terminal/classes/terminal.md new file mode 100644 index 0000000..c183ac2 --- /dev/null +++ b/_docs/api/terminal/classes/terminal.md @@ -0,0 +1,1052 @@ +--- +title: Terminal +category: API-classes +layout: docs +--- + + +# Class: Terminal + +The class that represents an xterm.js terminal. + +## Hierarchy + +**Terminal** + +## Implements + +* [IEventEmitter](../../interfaces/ieventemitter) +* [IDisposable](../../interfaces/idisposable) + +## Index + +### Constructors + +* [constructor](#constructor) + +### Properties + +* [cols](#cols) +* [element](#element) +* [markers](#markers) +* [rows](#rows) +* [textarea](#textarea) +* [strings](#strings) + +### Methods + +* [addDisposableListener](#adddisposablelistener) +* [addMarker](#addmarker) +* [attachCustomKeyEventHandler](#attachcustomkeyeventhandler) +* [blur](#blur) +* [clear](#clear) +* [clearSelection](#clearselection) +* [deregisterLinkMatcher](#deregisterlinkmatcher) +* [destroy](#destroy) +* [dispose](#dispose) +* [emit](#emit) +* [focus](#focus) +* [getOption](#getoption) +* [getSelection](#getselection) +* [hasSelection](#hasselection) +* [off](#off) +* [on](#on) +* [open](#open) +* [refresh](#refresh) +* [registerLinkMatcher](#registerlinkmatcher) +* [reset](#reset) +* [resize](#resize) +* [scrollLines](#scrolllines) +* [scrollPages](#scrollpages) +* [scrollToBottom](#scrolltobottom) +* [scrollToLine](#scrolltoline) +* [scrollToTop](#scrolltotop) +* [selectAll](#selectall) +* [selectLines](#selectlines) +* [setOption](#setoption) +* [write](#write) +* [writeln](#writeln) +* [applyAddon](#applyaddon) + +--- + +## Constructors + + + +### constructor + +⊕ **new Terminal**(options?: *[ITerminalOptions](../../interfaces/iterminaloptions)*): [Terminal](#) + +*Defined in [xterm.d.ts:307](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L307)* + +Creates a new `Terminal` object. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| `Optional` options | [ITerminalOptions](../../interfaces/iterminaloptions) | An object containing a set of options. | + +**Returns:** [Terminal](#) + +___ + +## Properties + + + +### cols + +**● cols**: *`number`* + +*Defined in [xterm.d.ts:296](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L296)* + +The number of columns in the terminal's viewport. + +___ + + +### element + +**● element**: *`HTMLElement`* + +*Defined in [xterm.d.ts:281](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L281)* + +The element containing the terminal. + +___ + + +### markers + +**● markers**: *[IMarker](../../interfaces/imarker)[]* + +*Defined in [xterm.d.ts:302](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L302)* + +(EXPERIMENTAL) Get all markers registered against the buffer. If the alt buffer is active this will always return \[\]. + +___ + + +### rows + +**● rows**: *`number`* + +*Defined in [xterm.d.ts:291](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L291)* + +The number of rows in the terminal's viewport. + +___ + + +### textarea + +**● textarea**: *`HTMLTextAreaElement`* + +*Defined in [xterm.d.ts:286](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L286)* + +The textarea that accepts input for the terminal. + +___ + + +### `` strings + +**● strings**: *[ILocalizableStrings](../../interfaces/ilocalizablestrings)* + +*Defined in [xterm.d.ts:307](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L307)* + +Natural language strings that can be localized. + +___ + +## Methods + + + +### addDisposableListener + +▸ **addDisposableListener**(type: *`string`*, handler: *`function`*): [IDisposable](../../interfaces/idisposable) + +*Defined in [xterm.d.ts:390](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L390)* + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| type | `string` | +| handler | `function` | + +**Returns:** [IDisposable](../../interfaces/idisposable) + +___ + + +### addMarker + +▸ **addMarker**(cursorYOffset: *`number`*): [IMarker](../../interfaces/imarker) + +*Defined in [xterm.d.ts:447](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L447)* + +(EXPERIMENTAL) Adds a marker to the normal buffer and returns it. If the alt buffer is active, undefined is returned. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| cursorYOffset | `number` | The y position offset of the marker from the cursor. | + +**Returns:** [IMarker](../../interfaces/imarker) + +___ + + +### attachCustomKeyEventHandler + +▸ **attachCustomKeyEventHandler**(customKeyEventHandler: *`function`*): `void` + +*Defined in [xterm.d.ts:422](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L422)* + +Attaches a custom key event handler which is run before keys are processed, giving consumers of xterm.js ultimate control as to what keys should be processed by the terminal and what keys should not. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| customKeyEventHandler | `function` | The custom KeyboardEvent handler to attach. This is a function that takes a KeyboardEvent, allowing consumers to stop propogation and/or prevent the default action. The function returns whether the event should be processed by xterm.js. | + +**Returns:** `void` + +___ + + +### blur + +▸ **blur**(): `void` + +*Defined in [xterm.d.ts:319](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L319)* + +Unfocus the terminal. + +**Returns:** `void` + +___ + + +### clear + +▸ **clear**(): `void` + +*Defined in [xterm.d.ts:521](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L521)* + +Clear the entire buffer, making the prompt line the new first line. + +**Returns:** `void` + +___ + + +### clearSelection + +▸ **clearSelection**(): `void` + +*Defined in [xterm.d.ts:463](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L463)* + +Clears the current terminal selection. + +**Returns:** `void` + +___ + + +### deregisterLinkMatcher + +▸ **deregisterLinkMatcher**(matcherId: *`number`*): `void` + +*Defined in [xterm.d.ts:440](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L440)* + +(EXPERIMENTAL) Deregisters a link matcher if it has been registered. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| matcherId | `number` | The link matcher's ID (returned after register) | + +**Returns:** `void` + +___ + + +### destroy + +▸ **destroy**(): `void` + +*Defined in [xterm.d.ts:488](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L488)* + +Destroys the terminal and detaches it from the DOM. +*__deprecated__*: Use dispose() instead. + +**Returns:** `void` + +___ + + +### dispose + +▸ **dispose**(): `void` + +*Implementation of [IDisposable](../../interfaces/idisposable).[dispose](../../interfaces/idisposable#dispose)* + +*Defined in [xterm.d.ts:481](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L481)* + +**Returns:** `void` + +___ + + +### emit + +▸ **emit**(type: *`string`*, data?: *`any`*): `void` + +*Implementation of [IEventEmitter](../../interfaces/ieventemitter).[emit](../../interfaces/ieventemitter#emit)* + +*Defined in [xterm.d.ts:388](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L388)* + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| type | `string` | +| `Optional` data | `any` | + +**Returns:** `void` + +___ + + +### focus + +▸ **focus**(): `void` + +*Defined in [xterm.d.ts:324](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L324)* + +Focus the terminal. + +**Returns:** `void` + +___ + + +### getOption + +▸ **getOption**(key: * "bellSound" | "bellStyle" | "cursorStyle" | "fontFamily" | "fontWeight" | "fontWeightBold" | "termName"*): `string` + +▸ **getOption**(key: * "allowTransparency" | "cancelEvents" | "convertEol" | "cursorBlink" | "debug" | "disableStdin" | "enableBold" | "macOptionIsMeta" | "rightClickSelectsWord" | "popOnBell" | "screenKeys" | "useFlowControl" | "visualBell"*): `boolean` + +▸ **getOption**(key: *"colors"*): `string`[] + +▸ **getOption**(key: * "cols" | "fontSize" | "letterSpacing" | "lineHeight" | "rows" | "tabStopWidth" | "scrollback"*): `number` + +▸ **getOption**(key: *"handler"*): `function` + +▸ **getOption**(key: *`string`*): `any` + +*Defined in [xterm.d.ts:533](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L533)* + +Retrieves an option's value from the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "bellSound" | "bellStyle" | "cursorStyle" | "fontFamily" | "fontWeight" | "fontWeightBold" | "termName"| The option key. | + +**Returns:** `string` + +*Defined in [xterm.d.ts:538](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L538)* + +Retrieves an option's value from the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "allowTransparency" | "cancelEvents" | "convertEol" | "cursorBlink" | "debug" | "disableStdin" | "enableBold" | "macOptionIsMeta" | "rightClickSelectsWord" | "popOnBell" | "screenKeys" | "useFlowControl" | "visualBell"| The option key. | + +**Returns:** `boolean` + +*Defined in [xterm.d.ts:543](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L543)* + +Retrieves an option's value from the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "colors" | The option key. | + +**Returns:** `string`[] + +*Defined in [xterm.d.ts:548](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L548)* + +Retrieves an option's value from the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "cols" | "fontSize" | "letterSpacing" | "lineHeight" | "rows" | "tabStopWidth" | "scrollback"| The option key. | + +**Returns:** `number` + +*Defined in [xterm.d.ts:553](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L553)* + +Retrieves an option's value from the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "handler" | The option key. | + +**Returns:** `function` + +*Defined in [xterm.d.ts:558](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L558)* + +Retrieves an option's value from the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | `string` | The option key. | + +**Returns:** `any` + +___ + + +### getSelection + +▸ **getSelection**(): `string` + +*Defined in [xterm.d.ts:458](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L458)* + +Gets the terminal's current selection, this is useful for implementing copy behavior outside of xterm.js. + +**Returns:** `string` + +___ + + +### hasSelection + +▸ **hasSelection**(): `boolean` + +*Defined in [xterm.d.ts:452](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L452)* + +Gets whether the terminal has an active selection. + +**Returns:** `boolean` + +___ + + +### off + +▸ **off**(type: * "blur" | "focus" | "linefeed" | "selection" | "data" | "key" | "keypress" | "keydown" | "refresh" | "resize" | "scroll" | "title" | `string`*, listener: *`function`*): `void` + +*Defined in [xterm.d.ts:386](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L386)* + +Deregisters an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | "blur" | "focus" | "linefeed" | "selection" | "data" | "key" | "keypress" | "keydown" | "refresh" | "resize" | "scroll" | "title" | `string`| The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +___ + + +### on + +▸ **on**(type: * "blur" | "focus" | "linefeed" | "selection"*, listener: *`function`*): `void` + +▸ **on**(type: *"data"*, listener: *`function`*): `void` + +▸ **on**(type: *"key"*, listener: *`function`*): `void` + +▸ **on**(type: * "keypress" | "keydown"*, listener: *`function`*): `void` + +▸ **on**(type: *"refresh"*, listener: *`function`*): `void` + +▸ **on**(type: *"resize"*, listener: *`function`*): `void` + +▸ **on**(type: *"scroll"*, listener: *`function`*): `void` + +▸ **on**(type: *"title"*, listener: *`function`*): `void` + +▸ **on**(type: *`string`*, listener: *`function`*): `void` + +*Defined in [xterm.d.ts:331](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L331)* + +Registers an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | "blur" | "focus" | "linefeed" | "selection"| The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:337](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L337)* + +Registers an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | "data" | The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:343](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L343)* + +Registers an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | "key" | The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:349](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L349)* + +Registers an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | "keypress" | "keydown"| The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:355](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L355)* + +Registers an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | "refresh" | The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:361](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L361)* + +Registers an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | "resize" | The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:367](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L367)* + +Registers an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | "scroll" | The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:373](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L373)* + +Registers an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | "title" | The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:379](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L379)* + +Registers an event listener. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| type | `string` | The type of the event. | +| listener | `function` | The listener. | + +**Returns:** `void` + +___ + + +### open + +▸ **open**(parent: *`HTMLElement`*): `void` + +*Defined in [xterm.d.ts:411](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L411)* + +Opens the terminal within an element. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| parent | `HTMLElement` | The element to create the terminal within. This element must be visible (have dimensions) when \`open\` is called as several DOM- based measurements need to be performed when this function is called. | + +**Returns:** `void` + +___ + + +### refresh + +▸ **refresh**(start: *`number`*, end: *`number`*): `void` + +*Defined in [xterm.d.ts:633](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L633)* + +Tells the renderer to refresh terminal content between two rows (inclusive) at the next opportunity. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| start | `number` | The row to start from (between 0 and this.rows - 1). | +| end | `number` | The row to end at (between start and this.rows - 1). | + +**Returns:** `void` + +___ + + +### registerLinkMatcher + +▸ **registerLinkMatcher**(regex: *`RegExp`*, handler: *`function`*, options?: *[ILinkMatcherOptions](../../interfaces/ilinkmatcheroptions)*): `number` + +*Defined in [xterm.d.ts:434](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L434)* + +(EXPERIMENTAL) Registers a link matcher, allowing custom link patterns to be matched and handled. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| regex | `RegExp` | The regular expression to search for, specifically this searches the textContent of the rows. You will want to use \\s to match a space ' ' character for example. | +| handler | `function` | The callback when the link is called. | +| `Optional` options | [ILinkMatcherOptions](../../interfaces/ilinkmatcheroptions) | Options for the link matcher. | + +**Returns:** `number` +The ID of the new matcher, this can be used to deregister. + +___ + + +### reset + +▸ **reset**(): `void` + +*Defined in [xterm.d.ts:638](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L638)* + +Perform a full reset (RIS, aka '\\x1bc'). + +**Returns:** `void` + +___ + + +### resize + +▸ **resize**(columns: *`number`*, rows: *`number`*): `void` + +*Defined in [xterm.d.ts:397](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L397)* + +Resizes the terminal. + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| columns | `number` | +| rows | `number` | + +**Returns:** `void` + +___ + + +### scrollLines + +▸ **scrollLines**(amount: *`number`*): `void` + +*Defined in [xterm.d.ts:494](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L494)* + +Scroll the display of the terminal + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| amount | `number` | The number of lines to scroll down (negative scroll up). | + +**Returns:** `void` + +___ + + +### scrollPages + +▸ **scrollPages**(pageCount: *`number`*): `void` + +*Defined in [xterm.d.ts:500](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L500)* + +Scroll the display of the terminal by a number of pages. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| pageCount | `number` | The number of pages to scroll (negative scrolls up). | + +**Returns:** `void` + +___ + + +### scrollToBottom + +▸ **scrollToBottom**(): `void` + +*Defined in [xterm.d.ts:510](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L510)* + +Scrolls the display of the terminal to the bottom. + +**Returns:** `void` + +___ + + +### scrollToLine + +▸ **scrollToLine**(line: *`number`*): `void` + +*Defined in [xterm.d.ts:516](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L516)* + +Scrolls to a line within the buffer. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| line | `number` | The 0-based line index to scroll to. | + +**Returns:** `void` + +___ + + +### scrollToTop + +▸ **scrollToTop**(): `void` + +*Defined in [xterm.d.ts:505](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L505)* + +Scrolls the display of the terminal to the top. + +**Returns:** `void` + +___ + + +### selectAll + +▸ **selectAll**(): `void` + +*Defined in [xterm.d.ts:468](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L468)* + +Selects all text within the terminal. + +**Returns:** `void` + +___ + + +### selectLines + +▸ **selectLines**(start: *`number`*, end: *`number`*): `void` + +*Defined in [xterm.d.ts:475](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L475)* + +Selects text in the buffer between 2 lines. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| start | `number` | The 0-based line index to select from (inclusive). | +| end | `number` | The 0-based line index to select to (inclusive). | + +**Returns:** `void` + +___ + + +### setOption + +▸ **setOption**(key: * "fontFamily" | "termName" | "bellSound"*, value: *`string`*): `void` + +▸ **setOption**(key: * "fontWeight" | "fontWeightBold"*, value: * `null` | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"*): `void` + +▸ **setOption**(key: *"bellStyle"*, value: * `null` | "none" | "visual" | "sound" | "both"*): `void` + +▸ **setOption**(key: *"cursorStyle"*, value: * `null` | "block" | "underline" | "bar"*): `void` + +▸ **setOption**(key: * "allowTransparency" | "cancelEvents" | "convertEol" | "cursorBlink" | "debug" | "disableStdin" | "enableBold" | "macOptionIsMeta" | "popOnBell" | "rightClickSelectsWord" | "screenKeys" | "useFlowControl" | "visualBell"*, value: *`boolean`*): `void` + +▸ **setOption**(key: *"colors"*, value: *`string`[]*): `void` + +▸ **setOption**(key: * "fontSize" | "letterSpacing" | "lineHeight" | "tabStopWidth" | "scrollback"*, value: *`number`*): `void` + +▸ **setOption**(key: *"handler"*, value: *`function`*): `void` + +▸ **setOption**(key: *"theme"*, value: *[ITheme](../../interfaces/itheme)*): `void` + +▸ **setOption**(key: * "cols" | "rows"*, value: *`number`*): `void` + +▸ **setOption**(key: *`string`*, value: *`any`*): `void` + +*Defined in [xterm.d.ts:565](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L565)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "fontFamily" | "termName" | "bellSound"| The option key. | +| value | `string` | The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:571](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L571)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "fontWeight" | "fontWeightBold"| The option key. | +| value | `null` | "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900"| The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:577](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L577)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "bellStyle" | The option key. | +| value | `null` | "none" | "visual" | "sound" | "both"| The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:583](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L583)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "cursorStyle" | The option key. | +| value | `null` | "block" | "underline" | "bar"| The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:589](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L589)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "allowTransparency" | "cancelEvents" | "convertEol" | "cursorBlink" | "debug" | "disableStdin" | "enableBold" | "macOptionIsMeta" | "popOnBell" | "rightClickSelectsWord" | "screenKeys" | "useFlowControl" | "visualBell"| The option key. | +| value | `boolean` | The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:595](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L595)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "colors" | The option key. | +| value | `string`[] | The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:601](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L601)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "fontSize" | "letterSpacing" | "lineHeight" | "tabStopWidth" | "scrollback"| The option key. | +| value | `number` | The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:607](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L607)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "handler" | The option key. | +| value | `function` | The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:613](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L613)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "theme" | The option key. | +| value | [ITheme](../../interfaces/itheme) | The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:619](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L619)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | "cols" | "rows"| The option key. | +| value | `number` | The option value. | + +**Returns:** `void` + +*Defined in [xterm.d.ts:625](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L625)* + +Sets an option on the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| key | `string` | The option key. | +| value | `any` | The option value. | + +**Returns:** `void` + +___ + + +### write + +▸ **write**(data: *`string`*): `void` + +*Defined in [xterm.d.ts:527](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L527)* + +Writes text to the terminal. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| data | `string` | The text to write to the terminal. | + +**Returns:** `void` + +___ + + +### writeln + +▸ **writeln**(data: *`string`*): `void` + +*Defined in [xterm.d.ts:403](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L403)* + +Writes text to the terminal, followed by a break line character (\\n). + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| data | `string` | The text to write to the terminal. | + +**Returns:** `void` + +___ + + +### `` applyAddon + +▸ **applyAddon**(addon: *`any`*): `void` + +*Defined in [xterm.d.ts:645](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L645)* + +Applies an addon to the Terminal prototype, making it available to all newly created Terminals. + +**Parameters:** + +| Param | Type | Description | +| ------ | ------ | ------ | +| addon | `any` | The addon to apply. | + +**Returns:** `void` + +___ + diff --git a/_docs/api/terminal/interfaces/idisposable.md b/_docs/api/terminal/interfaces/idisposable.md new file mode 100644 index 0000000..c09fd2e --- /dev/null +++ b/_docs/api/terminal/interfaces/idisposable.md @@ -0,0 +1,43 @@ +--- +title: IDisposable +category: API-interfaces +layout: docs +--- + + +# Interface: IDisposable + +An object that can be disposed via a dispose function. + +## Hierarchy + +**IDisposable** + +↳ [IMarker](../imarker) + +## Implemented by + +* [Terminal](../../classes/terminal) + +## Index + +### Methods + +* [dispose](#dispose) + +--- + +## Methods + + + +### dispose + +▸ **dispose**(): `void` + +*Defined in [xterm.d.ts:259](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L259)* + +**Returns:** `void` + +___ + diff --git a/_docs/api/terminal/interfaces/ieventemitter.md b/_docs/api/terminal/interfaces/ieventemitter.md new file mode 100644 index 0000000..ea5c3a4 --- /dev/null +++ b/_docs/api/terminal/interfaces/ieventemitter.md @@ -0,0 +1,103 @@ +--- +title: IEventEmitter +category: API-interfaces +layout: docs +--- + + +# Interface: IEventEmitter + +## Hierarchy + +**IEventEmitter** + +## Implemented by + +* [Terminal](../../classes/terminal) + +## Index + +### Methods + +* [addDisposableListener](#adddisposablelistener) +* [emit](#emit) +* [off](#off) +* [on](#on) + +--- + +## Methods + + + +### addDisposableListener + +▸ **addDisposableListener**(type: *`string`*, handler: *`function`*): [IDisposable](../idisposable) + +*Defined in [xterm.d.ts:252](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L252)* + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| type | `string` | +| handler | `function` | + +**Returns:** [IDisposable](../idisposable) + +___ + + +### emit + +▸ **emit**(type: *`string`*, data?: *`any`*): `void` + +*Defined in [xterm.d.ts:251](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L251)* + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| type | `string` | +| `Optional` data | `any` | + +**Returns:** `void` + +___ + + +### off + +▸ **off**(type: *`string`*, listener: *`function`*): `void` + +*Defined in [xterm.d.ts:250](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L250)* + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| type | `string` | +| listener | `function` | + +**Returns:** `void` + +___ + + +### on + +▸ **on**(type: *`string`*, listener: *`function`*): `void` + +*Defined in [xterm.d.ts:249](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L249)* + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| type | `string` | +| listener | `function` | + +**Returns:** `void` + +___ + diff --git a/_docs/api/terminal/interfaces/ilinkmatcheroptions.md b/_docs/api/terminal/interfaces/ilinkmatcheroptions.md new file mode 100644 index 0000000..3d8c33a --- /dev/null +++ b/_docs/api/terminal/interfaces/ilinkmatcheroptions.md @@ -0,0 +1,145 @@ +--- +title: ILinkMatcherOptions +category: API-interfaces +layout: docs +--- + + +# Interface: ILinkMatcherOptions + +An object containing options for a link matcher. + +## Hierarchy + +**ILinkMatcherOptions** + +## Index + +### Properties + +* [leaveCallback](#leavecallback) +* [matchIndex](#matchindex) +* [priority](#priority) +* [tooltipCallback](#tooltipcallback) +* [validationCallback](#validationcallback) +* [willLinkActivate](#willlinkactivate) + +--- + +## Properties + + + +### `` leaveCallback + +**● leaveCallback**: *`function`* + +*Defined in [xterm.d.ts:230](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L230)* + +A callback that fires when the mouse leaves a link. Note that this can happen even when tooltipCallback hasn't fired for the link yet. + +#### Type declaration +▸(event: *`MouseEvent`*, uri: *`string`*): `boolean` | `void` + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| event | `MouseEvent` | +| uri | `string` | + +**Returns:** `boolean` | `void` + +___ + + +### `` matchIndex + +**● matchIndex**: *`number`* + +*Defined in [xterm.d.ts:213](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L213)* + +The index of the link from the regex.match(text) call. This defaults to 0 (for regular expressions without capture groups). + +___ + + +### `` priority + +**● priority**: *`number`* + +*Defined in [xterm.d.ts:237](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L237)* + +The priority of the link matcher, this defines the order in which the link matcher is evaluated relative to others, from highest to lowest. The default value is 0. + +___ + + +### `` tooltipCallback + +**● tooltipCallback**: *`function`* + +*Defined in [xterm.d.ts:224](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L224)* + +A callback that fires when the mouse hovers over a link for a moment. + +#### Type declaration +▸(event: *`MouseEvent`*, uri: *`string`*): `boolean` | `void` + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| event | `MouseEvent` | +| uri | `string` | + +**Returns:** `boolean` | `void` + +___ + + +### `` validationCallback + +**● validationCallback**: *`function`* + +*Defined in [xterm.d.ts:219](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L219)* + +A callback that validates whether to create an individual link, pass whether the link is valid to the callback. + +#### Type declaration +▸(uri: *`string`*, callback: *`function`*): `void` + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| uri | `string` | +| callback | `function` | + +**Returns:** `void` + +___ + + +### `` willLinkActivate + +**● willLinkActivate**: *`function`* + +*Defined in [xterm.d.ts:245](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L245)* + +A callback that fires when the mousedown and click events occur that determines whether a link will be activated upon click. This enables only activating a link when a certain modifier is held down, if not the mouse event will continue propagation (eg. double click to select word). + +#### Type declaration +▸(event: *`MouseEvent`*, uri: *`string`*): `boolean` + +**Parameters:** + +| Param | Type | +| ------ | ------ | +| event | `MouseEvent` | +| uri | `string` | + +**Returns:** `boolean` + +___ + diff --git a/_docs/api/terminal/interfaces/ilocalizablestrings.md b/_docs/api/terminal/interfaces/ilocalizablestrings.md new file mode 100644 index 0000000..24599ab --- /dev/null +++ b/_docs/api/terminal/interfaces/ilocalizablestrings.md @@ -0,0 +1,53 @@ +--- +title: ILocalizableStrings +category: API-interfaces +layout: docs +--- + + +# Interface: ILocalizableStrings + +## Hierarchy + +**ILocalizableStrings** + +## Index + +### Properties + +* [blankLine](#blankline) +* [promptLabel](#promptlabel) +* [tooMuchOutput](#toomuchoutput) + +--- + +## Properties + + + +### blankLine + +**● blankLine**: *`string`* + +*Defined in [xterm.d.ts:269](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L269)* + +___ + + +### promptLabel + +**● promptLabel**: *`string`* + +*Defined in [xterm.d.ts:270](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L270)* + +___ + + +### tooMuchOutput + +**● tooMuchOutput**: *`string`* + +*Defined in [xterm.d.ts:271](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L271)* + +___ + diff --git a/_docs/api/terminal/interfaces/imarker.md b/_docs/api/terminal/interfaces/imarker.md new file mode 100644 index 0000000..76d33da --- /dev/null +++ b/_docs/api/terminal/interfaces/imarker.md @@ -0,0 +1,75 @@ +--- +title: IMarker +category: API-interfaces +layout: docs +--- + + +# Interface: IMarker + +## Hierarchy + + [IDisposable](../idisposable) + +**↳ IMarker** + +## Index + +### Properties + +* [id](#id) +* [isDisposed](#isdisposed) +* [line](#line) + +### Methods + +* [dispose](#dispose) + +--- + +## Properties + + + +### id + +**● id**: *`number`* + +*Defined in [xterm.d.ts:263](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L263)* + +___ + + +### isDisposed + +**● isDisposed**: *`boolean`* + +*Defined in [xterm.d.ts:264](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L264)* + +___ + + +### line + +**● line**: *`number`* + +*Defined in [xterm.d.ts:265](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L265)* + +___ + +## Methods + + + +### dispose + +▸ **dispose**(): `void` + +*Inherited from [IDisposable](../idisposable).[dispose](../idisposable#dispose)* + +*Defined in [xterm.d.ts:259](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L259)* + +**Returns:** `void` + +___ + diff --git a/_docs/api/terminal/interfaces/iterminaloptions.md b/_docs/api/terminal/interfaces/iterminaloptions.md new file mode 100644 index 0000000..7d47cd9 --- /dev/null +++ b/_docs/api/terminal/interfaces/iterminaloptions.md @@ -0,0 +1,311 @@ +--- +title: ITerminalOptions +category: API-interfaces +layout: docs +--- + + +# Interface: ITerminalOptions + +An object containing start up options for the terminal. + +## Hierarchy + +**ITerminalOptions** + +## Index + +### Properties + +* [allowTransparency](#allowtransparency) +* [bellSound](#bellsound) +* [bellStyle](#bellstyle) +* [cols](#cols) +* [cursorBlink](#cursorblink) +* [cursorStyle](#cursorstyle) +* [disableStdin](#disablestdin) +* [drawBoldTextInBrightColors](#drawboldtextinbrightcolors) +* [enableBold](#enablebold) +* [experimentalCharAtlas](#experimentalcharatlas) +* [fontFamily](#fontfamily) +* [fontSize](#fontsize) +* [fontWeight](#fontweight) +* [fontWeightBold](#fontweightbold) +* [letterSpacing](#letterspacing) +* [lineHeight](#lineheight) +* [macOptionIsMeta](#macoptionismeta) +* [rightClickSelectsWord](#rightclickselectsword) +* [rows](#rows) +* [screenReaderMode](#screenreadermode) +* [scrollback](#scrollback) +* [tabStopWidth](#tabstopwidth) +* [theme](#theme) + +--- + +## Properties + + + +### `` allowTransparency + +**● allowTransparency**: *`boolean`* + +*Defined in [xterm.d.ts:25](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L25)* + +Whether background should support non-opaque color. It must be set before executing open() method and can't be changed later without excuting it again. Warning: Enabling this option can reduce performances somewhat. + +___ + + +### `` bellSound + +**● bellSound**: *`string`* + +*Defined in [xterm.d.ts:30](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L30)* + +A data uri of the sound to use for the bell (needs bellStyle = 'sound'). + +___ + + +### `` bellStyle + +**● bellStyle**: * "none" | "sound" +* + +*Defined in [xterm.d.ts:35](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L35)* + +The type of the bell notification the terminal will use. + +___ + + +### `` cols + +**● cols**: *`number`* + +*Defined in [xterm.d.ts:40](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L40)* + +The number of columns in the terminal. + +___ + + +### `` cursorBlink + +**● cursorBlink**: *`boolean`* + +*Defined in [xterm.d.ts:45](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L45)* + +Whether the cursor blinks. + +___ + + +### `` cursorStyle + +**● cursorStyle**: * "block" | "underline" | "bar" +* + +*Defined in [xterm.d.ts:50](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L50)* + +The style of the cursor. + +___ + + +### `` disableStdin + +**● disableStdin**: *`boolean`* + +*Defined in [xterm.d.ts:55](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L55)* + +Whether input should be disabled. + +___ + + +### `` drawBoldTextInBrightColors + +**● drawBoldTextInBrightColors**: *`boolean`* + +*Defined in [xterm.d.ts:60](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L60)* + +Whether to draw bold text in bright colors. The default is true. + +___ + + +### `` enableBold + +**● enableBold**: *`boolean`* + +*Defined in [xterm.d.ts:67](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L67)* + +Whether to enable the rendering of bold text. +*__deprecated__*: Use fontWeight and fontWeightBold instead. + +___ + + +### `` experimentalCharAtlas + +**● experimentalCharAtlas**: * "none" | "static" | "dynamic" +* + +*Defined in [xterm.d.ts:85](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L85)* + +What character atlas implementation to use. The character atlas caches drawn characters, speeding up rendering significantly. However, it can introduce some minor rendering artifacts. + +* 'none': Don't use an atlas. +* 'static': Generate an atlas when the terminal starts or is reconfigured. This atlas will only contain ASCII characters in 16 colors. +* 'dynamic': Generate an atlas using a LRU cache as characters are requested. Limited to ASCII characters (for now), but supports 256 colors. For characters covered by the static cache, it's slightly slower in comparison, since there's more overhead involved in managing the cache. + +Currently defaults to 'static'. This option may be removed in the future. If it is, passed parameters will be ignored. + +___ + + +### `` fontFamily + +**● fontFamily**: *`string`* + +*Defined in [xterm.d.ts:95](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L95)* + +The font family used to render text. + +___ + + +### `` fontSize + +**● fontSize**: *`number`* + +*Defined in [xterm.d.ts:90](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L90)* + +The font size used to render text. + +___ + + +### `` fontWeight + +**● fontWeight**: *[FontWeight](../../modules/xterm#fontweight)* + +*Defined in [xterm.d.ts:100](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L100)* + +The font weight used to render non-bold text. + +___ + + +### `` fontWeightBold + +**● fontWeightBold**: *[FontWeight](../../modules/xterm#fontweight)* + +*Defined in [xterm.d.ts:105](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L105)* + +The font weight used to render bold text. + +___ + + +### `` letterSpacing + +**● letterSpacing**: *`number`* + +*Defined in [xterm.d.ts:110](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L110)* + +The spacing in whole pixels between characters.. + +___ + + +### `` lineHeight + +**● lineHeight**: *`number`* + +*Defined in [xterm.d.ts:115](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L115)* + +The line height used to render text. + +___ + + +### `` macOptionIsMeta + +**● macOptionIsMeta**: *`boolean`* + +*Defined in [xterm.d.ts:120](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L120)* + +Whether to treat option as the meta key. + +___ + + +### `` rightClickSelectsWord + +**● rightClickSelectsWord**: *`boolean`* + +*Defined in [xterm.d.ts:126](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L126)* + +Whether to select the word under the cursor on right click, this is standard behavior in a lot of macOS applications. + +___ + + +### `` rows + +**● rows**: *`number`* + +*Defined in [xterm.d.ts:131](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L131)* + +The number of rows in the terminal. + +___ + + +### `` screenReaderMode + +**● screenReaderMode**: *`boolean`* + +*Defined in [xterm.d.ts:138](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L138)* + +Whether screen reader support is enabled. When on this will expose supporting elements in the DOM to support NVDA on Windows and VoiceOver on macOS. + +___ + + +### `` scrollback + +**● scrollback**: *`number`* + +*Defined in [xterm.d.ts:144](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L144)* + +The amount of scrollback in the terminal. Scrollback is the amount of rows that are retained when lines are scrolled beyond the initial viewport. + +___ + + +### `` tabStopWidth + +**● tabStopWidth**: *`number`* + +*Defined in [xterm.d.ts:149](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L149)* + +The size of tab stops in the terminal. + +___ + + +### `` theme + +**● theme**: *[ITheme](../itheme)* + +*Defined in [xterm.d.ts:154](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L154)* + +The color theme of the terminal. + +___ + diff --git a/_docs/api/terminal/interfaces/itheme.md b/_docs/api/terminal/interfaces/itheme.md new file mode 100644 index 0000000..a3fc4b0 --- /dev/null +++ b/_docs/api/terminal/interfaces/itheme.md @@ -0,0 +1,277 @@ +--- +title: ITheme +category: API-interfaces +layout: docs +--- + + +# Interface: ITheme + +Contains colors to theme the terminal with. + +## Hierarchy + +**ITheme** + +## Index + +### Properties + +* [background](#background) +* [black](#black) +* [blue](#blue) +* [brightBlack](#brightblack) +* [brightBlue](#brightblue) +* [brightCyan](#brightcyan) +* [brightGreen](#brightgreen) +* [brightMagenta](#brightmagenta) +* [brightRed](#brightred) +* [brightWhite](#brightwhite) +* [brightYellow](#brightyellow) +* [cursor](#cursor) +* [cursorAccent](#cursoraccent) +* [cyan](#cyan) +* [foreground](#foreground) +* [green](#green) +* [magenta](#magenta) +* [red](#red) +* [selection](#selection) +* [white](#white) +* [yellow](#yellow) + +--- + +## Properties + + + +### `` background + +**● background**: *`string`* + +*Defined in [xterm.d.ts:164](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L164)* + +The default background color + +___ + + +### `` black + +**● black**: *`string`* + +*Defined in [xterm.d.ts:172](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L172)* + +ANSI black (eg. `\x1b[30m`) + +___ + + +### `` blue + +**● blue**: *`string`* + +*Defined in [xterm.d.ts:180](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L180)* + +ANSI blue (eg. `\x1b[34m`) + +___ + + +### `` brightBlack + +**● brightBlack**: *`string`* + +*Defined in [xterm.d.ts:188](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L188)* + +ANSI bright black (eg. `\x1b[1;30m`) + +___ + + +### `` brightBlue + +**● brightBlue**: *`string`* + +*Defined in [xterm.d.ts:196](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L196)* + +ANSI bright blue (eg. `\x1b[1;34m`) + +___ + + +### `` brightCyan + +**● brightCyan**: *`string`* + +*Defined in [xterm.d.ts:200](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L200)* + +ANSI bright cyan (eg. `\x1b[1;36m`) + +___ + + +### `` brightGreen + +**● brightGreen**: *`string`* + +*Defined in [xterm.d.ts:192](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L192)* + +ANSI bright green (eg. `\x1b[1;32m`) + +___ + + +### `` brightMagenta + +**● brightMagenta**: *`string`* + +*Defined in [xterm.d.ts:198](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L198)* + +ANSI bright magenta (eg. `\x1b[1;35m`) + +___ + + +### `` brightRed + +**● brightRed**: *`string`* + +*Defined in [xterm.d.ts:190](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L190)* + +ANSI bright red (eg. `\x1b[1;31m`) + +___ + + +### `` brightWhite + +**● brightWhite**: *`string`* + +*Defined in [xterm.d.ts:202](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L202)* + +ANSI bright white (eg. `\x1b[1;37m`) + +___ + + +### `` brightYellow + +**● brightYellow**: *`string`* + +*Defined in [xterm.d.ts:194](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L194)* + +ANSI bright yellow (eg. `\x1b[1;33m`) + +___ + + +### `` cursor + +**● cursor**: *`string`* + +*Defined in [xterm.d.ts:166](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L166)* + +The cursor color + +___ + + +### `` cursorAccent + +**● cursorAccent**: *`string`* + +*Defined in [xterm.d.ts:168](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L168)* + +The accent color of the cursor (used as the foreground color for a block cursor) + +___ + + +### `` cyan + +**● cyan**: *`string`* + +*Defined in [xterm.d.ts:184](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L184)* + +ANSI cyan (eg. `\x1b[36m`) + +___ + + +### `` foreground + +**● foreground**: *`string`* + +*Defined in [xterm.d.ts:162](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L162)* + +The default foreground color + +___ + + +### `` green + +**● green**: *`string`* + +*Defined in [xterm.d.ts:176](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L176)* + +ANSI green (eg. `\x1b[32m`) + +___ + + +### `` magenta + +**● magenta**: *`string`* + +*Defined in [xterm.d.ts:182](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L182)* + +ANSI magenta (eg. `\x1b[35m`) + +___ + + +### `` red + +**● red**: *`string`* + +*Defined in [xterm.d.ts:174](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L174)* + +ANSI red (eg. `\x1b[31m`) + +___ + + +### `` selection + +**● selection**: *`string`* + +*Defined in [xterm.d.ts:170](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L170)* + +The selection color (can be transparent) + +___ + + +### `` white + +**● white**: *`string`* + +*Defined in [xterm.d.ts:186](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L186)* + +ANSI white (eg. `\x1b[37m`) + +___ + + +### `` yellow + +**● yellow**: *`string`* + +*Defined in [xterm.d.ts:178](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L178)* + +ANSI yellow (eg. `\x1b[33m`) + +___ + diff --git a/_docs/api/terminal/modules/xterm.md b/_docs/api/terminal/modules/xterm.md new file mode 100644 index 0000000..7d15313 --- /dev/null +++ b/_docs/api/terminal/modules/xterm.md @@ -0,0 +1,50 @@ +--- +title: "xterm" +category: API-modules +layout: docs +--- + + +# Module: "xterm" + +*__license__*: MIT + +This contains the type declarations for the xterm.js library. Note that some interfaces differ between this file and the actual implementation in src/, that's because this file declares the _public_ API which is intended to be stable and consumed by external programs. + +## Index + +### Classes + +* [Terminal](../../classes/terminal) + +### Interfaces + +* [IDisposable](../../interfaces/idisposable) +* [IEventEmitter](../../interfaces/ieventemitter) +* [ILinkMatcherOptions](../../interfaces/ilinkmatcheroptions) +* [ILocalizableStrings](../../interfaces/ilocalizablestrings) +* [IMarker](../../interfaces/imarker) +* [ITerminalOptions](../../interfaces/iterminaloptions) +* [ITheme](../../interfaces/itheme) + +### Type aliases + +* [FontWeight](#fontweight) + +--- + +## Type aliases + + + +### FontWeight + +**ΤFontWeight**: * "normal" | "bold" | "100" | "200" | "300" | "400" | "500" | "600" | "700" | "800" | "900" +* + +*Defined in [xterm.d.ts:14](https://github.com/xtermjs/xterm.js/blob/master/typings/xterm.d.ts#L14)* + +A string representing text font weight. + +___ + From d7594ce2c039aa1e4b8a3952bb5cc0f6efbefeaa Mon Sep 17 00:00:00 2001 From: pro-src Date: Thu, 24 May 2018 20:23:04 -0500 Subject: [PATCH 4/5] Properly adapt typedoc output for Jekyll --- .gitignore | 3 +- _config.yml | 3 +- ...t.html => docs-category-article-list.html} | 0 _layouts/docs.html | 5 +- _pages/docs.html | 16 ++- bin/update-docs | 4 +- gulpfile.js | 135 ++++++++++-------- 7 files changed, 94 insertions(+), 72 deletions(-) rename _includes/{docs-categoty-article-list.html => docs-category-article-list.html} (100%) diff --git a/.gitignore b/.gitignore index 651505f..df655e5 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,5 @@ _site package-lock.json node_modules/ -xterm.js/ +_typedoc/ +_xterm.js/ diff --git a/_config.yml b/_config.yml index 3d456b5..26ae4c7 100644 --- a/_config.yml +++ b/_config.yml @@ -18,8 +18,9 @@ include: exclude: - gulpfile.js - package.json + - node_modules/ - bin/ - + collections: docs: output: true diff --git a/_includes/docs-categoty-article-list.html b/_includes/docs-category-article-list.html similarity index 100% rename from _includes/docs-categoty-article-list.html rename to _includes/docs-category-article-list.html diff --git a/_layouts/docs.html b/_layouts/docs.html index 3dcb8dd..f5cb0f9 100644 --- a/_layouts/docs.html +++ b/_layouts/docs.html @@ -1,8 +1,11 @@ --- layout: default --- +
+ {% unless page.category contains "API" %}

{% if page.category == "addon" %}Addons / {% endif %}{{ page.title }}

+ {% endunless %}
{{ content }}
@@ -18,4 +21,4 @@

{% if page.category == "addon" %}Addons / {% endif %}API Reference

+{% include docs-category-article-list.html category="API" %} +

Modules

+{% include docs-category-article-list.html category="API-modules" %} +

Classes

+{% include docs-category-article-list.html category="API-classes" %} +

Interfaces

+{% include docs-category-article-list.html category="API-interfaces" %} -{% include docs-categoty-article-list.html category="API" %} - -

Addons

-{% include docs-categoty-article-list.html category="addon" %} \ No newline at end of file +

Addons

+{% include docs-category-article-list.html category="addon" %} diff --git a/bin/update-docs b/bin/update-docs index 70b8754..ee9da88 100755 --- a/bin/update-docs +++ b/bin/update-docs @@ -10,8 +10,8 @@ set -e set +x -git clone --recursive https://github.com/xtermjs/xterm.js -TAG=$(cd xterm.js && git describe --tags) +git clone --recursive https://github.com/xtermjs/xterm.js _xterm.js +TAG=$(cd _xterm.js && git describe --tags) npm run build:docs diff --git a/gulpfile.js b/gulpfile.js index b36dca3..3dacc47 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -8,25 +8,18 @@ const typedoc = require('gulp-typedoc'); const fs = require('fs-extra'); const path = require('path'); -gulp.task('docs:clean', async function() { - const directory = path.join(__dirname, '_docs/api/terminal'); - if (await fs.pathExists(directory)) { - await fs.remove(directory); - } -}) - /** * Generate TypeScript project markdown */ -gulp.task('docs:build', ['docs:clean'], function() { - return gulp.src('./xterm.js/typings/xterm.d.ts') +gulp.task('typedoc', function() { + return gulp.src('./_xterm.js/typings/xterm.d.ts') .pipe(typedoc({ // TypeScript options (see typescript docs) module: 'commonjs', target: 'es5', // Output options (see typedoc docs) - out: './_docs/api/terminal/', + out: './_typedoc', // Required to process .d.ts files includeDeclarations: true, // Exclude @types/node, etc. @@ -46,81 +39,101 @@ gulp.task('docs:build', ['docs:clean'], function() { /** * This task works around the following issues: * - * _docs/api/terminal/README.md only contains a link to - * _docs/api/terminal/modules/_xterm_d_.md - * - * _docs/api/terminal/modules/_xterm_d_.md only contains a link to - * _docs/api/terminal/modules/_xterm_d_._xterm_.md - * - * The nearly empty files are removed and - * _docs/api/terminal/modules/_xterm_d_._xterm_.md is moved to - * _docs/api/terminal/index.md - * - * Links are modified to reflect these changes. + * Some files are nearly empty i.e. README.md and modules/_xterm_d_.md + * Files are not well named and Jekyll ignores files prefixed with underscores + * Links to markdown documents must not have an ".md" extension, etc. * @TODO: Some interfaces are too verbose and should be simplified + * + * The files are renamed/moved to ./_docs/api/terminal and links are updated + * as necessary to work after being processed by Jekyll */ -gulp.task('docs:patch', ['docs:build'], async function() { - const docs = (...args) => - path.join(__dirname, '_docs/api/terminal', ...args); +gulp.task('docs', ['typedoc'], async function() { + // YAML Front Matters for Jekyll + const header = (title, category = 'API', layout = 'docs') => + `---\ntitle: ${title}\ncategory: ${category}\nlayout: ${layout}\n---\n\n`; + + // Retains hash identifiers if they exist + const rename = (basename) => { + const match = basename.match(/^.*?([^\._]+)_?\.md(#.*|$)/); + if (match === null) { + throw new Error(`Unknown file naming scheme: ${basename}`) + } + return match[1] + match[2]; + }; - // Remove unnecessary files - await fs.remove(docs('README.md')); - await fs.remove(docs('modules/_xterm_d_.md')); + const srcdir = path.join(__dirname, '_typedoc'); + const outdir = path.join(__dirname, '_docs/api/terminal'); - // Regex to match filenames that should be replaced with index.md - const filenames = /(readme\.|(modules\/)?(_xterm_(d_)?\.)+)md(?=#|$)/i; + // Cleanup + if (await fs.pathExists(outdir)) { + await fs.remove(outdir); + } - // All of the files that need to be updated are in subdirs - for (const dirname of await fs.readdir(docs())) { - const directory = docs(dirname); - for (const basename of await fs.readdir(directory)) { - const document = path.join(directory, basename); - // Match markdown links i.e. [name](../some/relative/file) - const re = /\[([^\[\]]*)\]\(([^()]*)\)/g; + const excludes = /\/(README.md|modules\/_xterm_d_.md)$/i; + const directories = ['.']; - let data = await fs.readFile(document, 'utf-8'); - let modified = false; - let match; + for (const /* relative */ subdir of directories) { + const directory = path.join(srcdir, subdir); + for (const basename of await fs.readdir(directory)) { + const file = path.join(directory, basename); + if (excludes.test(file)) { + continue; + } - if (basename === '_xterm_d_._xterm_.md') { - // Remove the navigation links from the index document - data = data.substring(data.indexOf('\n') + 1); - modified = true; + const stats = await fs.lstat(file); + if (stats.isDirectory()) { + directories.push(path.join(subdir, basename)); + continue; } + let data = await fs.readFile(file, 'utf-8'); + let title = ''; + let match; + + // Match markdown links i.e. [name](../some/relative/file) + const re = /\[([^\[\]]*)\]\(([^()]*)\)/g; while ((match = re.exec(data)) !== null) { - let [link, title, uri] = match; - let replacement = ''; + let [link, link_title, uri] = match; - if (/_xterm_(d_)?\.md(#|$)/.test(uri) && - data.substring(re.lastIndex, re.lastIndex + 3) === ' > ') { - // Remove the navigation link and the angle bracket that follows - re.lastIndex += 3; + if (/^https?/.test(uri)) { + continue; } - else if (filenames.test(uri)) { - uri = uri.replace(filenames, 'index.md'); - replacement = `[${title}](${uri})`; + + if (uri.indexOf(basename) !== -1) { + // Extract the page title from the self-referring navigation link + if (uri.endsWith(basename) /* without hash identifier */) { + title = link_title; + } + uri = uri.indexOf('#') !== -1 ? uri.replace(basename, '') : '#'; } else { - continue; + const link_name = rename(path.basename(uri)); + const link_path = path.dirname(uri); + uri = '../' + (link_path === '.' ? + link_name : link_path + '/' + link_name); } + const replacement = `[${link_title}](${uri})`; data = data.substr(0, match.index) + replacement + data.substr(re.lastIndex); re.lastIndex = match.index + replacement.length; - modified = true; } - if (modified) { - await fs.writeFile(document, data, 'utf-8'); + if (title === '') { + throw new Error(`Failed to extract document title from: ${file}`); } + + // Remove the navigation links from the top of the document + data = data.substring(data.indexOf('\n') + 1); + // Prepend the YAML Front Matters + data = header(title, subdir === '.' ? 'API' : `API-${subdir}`) + data; + + const dest = path.join(outdir, subdir); + await fs.ensureDir(dest); + const outfile = path.join(dest, rename(basename) + '.md'); + await fs.writeFile(outfile, data, 'utf-8'); } } - - // Move the main markdown document to ./_docs/api/terminal/index.md - await fs.move(docs('modules/_xterm_d_._xterm_.md'), - docs('index.md')); }); -gulp.task('docs', ['docs:patch']); gulp.task('default', ['docs']); From bf26d70fd6eb48f9d010287d192ca9cb8561a803 Mon Sep 17 00:00:00 2001 From: Paris Kasidiaris Date: Mon, 28 May 2018 09:08:35 +0300 Subject: [PATCH 5/5] Bump docs version to 3.4 --- _config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index 26ae4c7..9ecb4cc 100644 --- a/_config.yml +++ b/_config.yml @@ -4,7 +4,7 @@ description: Terminal front-end component written in JavaScript that works in th baseurl: "" url: "http://xtermjs.org" -version: "3.1.0" +version: "3.4" markdown: kramdown