當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript ansi_up.ansi_to_html函數代碼示例

本文整理匯總了TypeScript中ansi_up.ansi_to_html函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript ansi_to_html函數的具體用法?TypeScript ansi_to_html怎麽用?TypeScript ansi_to_html使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ansi_to_html函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: renderText

function renderText(options: renderText.IRenderOptions): Promise<void> {
  // Unpack the options.
  let { host, source } = options;

  // Escape the terminal codes and HTML tags.
  let data = escape_for_html(source);

  // Create the HTML content.
  let content = ansi_to_html(data, { use_classes: true });

  // Set the inner HTML for the host node.
  host.innerHTML = `<pre>${content}</pre>`;

  // Return the rendered promise.
  return Promise.resolve(undefined);
}
開發者ID:cameronoelsen,項目名稱:jupyterlab,代碼行數:16,代碼來源:renderers.ts

示例2: escapeTerminalOutput

// prepare raw data for passing to jQuery.terminal's .echo method
function escapeTerminalOutput(text) {
    // term.echo will always append newline (which, by the way, really
    // messes up commands that write lines to stdout in multiple chunks,
    // see https://github.com/hraban/lush/issues/67) so strip one off
    // the end of the output if there already is one.
    if (U.hassuffix(text, '\r\n')) {
        text = text.slice(0, -2);
    } else if (U.hassuffix(text, '\n')) {
        text = text.slice(0, -1);
    }
    text = U.escapeHTML(text);
    text = ansi_up.ansi_to_html(text);
    // jquery.terminal interprets square brackets in a weird way
    text = text.replace(/\[/g, '&#91;');
    return text;
}
開發者ID:hraban,項目名稱:lush,代碼行數:17,代碼來源:terminal_jquery.ts

示例3: renderText

export function renderText(options: renderText.IRenderOptions): Promise<void> {
  // Unpack the options.
  let { host, source } = options;

  const ansiUp = new AnsiUp();
  ansiUp.escape_for_html = true;
  ansiUp.use_classes = true;

  // Create the HTML content.
  let content = ansiUp.ansi_to_html(source);

  // Set the inner HTML for the host node.
  host.innerHTML = `<pre>${content}</pre>`;

  // Return the rendered promise.
  return Promise.resolve(undefined);
}
開發者ID:SylvainCorlay,項目名稱:jupyterlab,代碼行數:17,代碼來源:renderers.ts

示例4: appendToBuildLog

function appendToBuildLog(build, text) {
    return {
        type: APPEND_TO_BUILD_LOG,
        payload: { buildId: build.id, text: ansiToHtml(text) }
    };
}
開發者ID:MikeTLive,項目名稱:habitat,代碼行數:6,代碼來源:projects.ts

示例5: populateBuildLog

export function populateBuildLog(id, data) {
    return {
        type: POPULATE_BUILD_LOG,
        payload: { id, data: data ? ansiToHtml(data) : undefined },
    };
}
開發者ID:MikeTLive,項目名稱:habitat,代碼行數:6,代碼來源:projects.ts


注:本文中的ansi_up.ansi_to_html函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。