1/* 2 * pandoc_capabilities.ts 3 * 4 * Copyright (C) 2021 by RStudio, PBC 5 * 6 * Unless you have received this program directly from RStudio pursuant 7 * to the terms of a commercial license agreement with RStudio, then 8 * this program is licensed to you under the terms of version 3 of the 9 * GNU Affero General Public License. This program is distributed WITHOUT 10 * ANY EXPRESS OR IMPLIED WARRANTY, INCLUDING THOSE OF NON-INFRINGEMENT, 11 * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Please refer to the 12 * AGPL (http://www.gnu.org/licenses/agpl-3.0.txt) for more details. 13 * 14 */ 15 16import { PandocServer, parsePandocListOutput, PandocApiVersion } from './pandoc'; 17 18export interface PandocCapabilitiesResult { 19 version: string; 20 api_version: PandocApiVersion; 21 output_formats: string; 22 highlight_languages: string; 23} 24 25export interface PandocCapabilities { 26 version: string; 27 api_version: PandocApiVersion; 28 output_formats: string[]; 29 highlight_languages: string[]; 30} 31 32export async function getPandocCapabilities(server: PandocServer) { 33 const result = await server.getCapabilities(); 34 return { 35 version: result.version, 36 api_version: result.api_version, 37 output_formats: parsePandocListOutput(result.output_formats), 38 highlight_languages: parsePandocListOutput(result.highlight_languages), 39 }; 40} 41