Quarto Inspect

개요

quarto inspect 명령은 Quarto 프로젝트 또는 문서의 설정 정보를 담은 JSON 객체를 생성합니다. 이 출력은 Quarto 콘텐츠를 분석하는 도구나 라이브러리를 만드는 개발자에게 특히 유용합니다.

가능하다면 프로젝트나 문서를 직접 파싱하기보다 quarto inspect 출력을 활용하는 것이 좋습니다.

제공되는 정보

quarto inspect는 프로젝트 전체, 프로젝트 밖의 단일 문서, 프로젝트 안에 있는 문서에 대한 정보를 모두 제공합니다.

문서 단위 정보

문서 단위 정보는 quarto inspect <문서경로> 명령으로 얻습니다. 추가 인자를 주지 않으면 표준 출력으로 JSON이 표시되고, 경로를 인자로 주면 해당 파일로 저장됩니다.

  • quarto: 사용 중인 Quarto 버전을 설명하는 객체
  • engines: 문서에서 사용한 실행 엔진을 담은 배열 (아래 프로젝트 정보와 스키마를 맞추기 위해 단일 값도 배열로 표현)
  • formats: 키가 문서 포맷 이름이고 값이 해당 포맷 메타데이터인 객체
  • resources: 렌더링에 필요한 추가 리소스 경로 배열
  • fileInformation: 키가 파일 이름인 객체. 각 값은 다음 정보를 포함합니다.
    • includeMap: include 숏코드 사용을 나타내는 source, target 경로 배열
    • codeCells: 문서(및 include로 포함된 파일)에 있는 코드 셀을 설명하는 객체 배열
      • start: 코드 셀이 시작되는 줄 번호
      • end: 코드 셀이 끝나는 줄 번호
      • file: 코드 셀이 실제로 위치한 파일 경로(Include로 인해 원본과 다를 수 있음)
      • source: 코드 셀 내용
      • language: 코드 셀 언어
      • metadata: 코드 셀 메타데이터
  • project: 문서가 프로젝트에 속해 있다면, 해당 프로젝트에서 quarto inspect를 실행했을 때의 출력이 포함됩니다.

프로젝트 단위 정보

프로젝트 루트에서 quarto inspect를 실행하거나 quarto inspect <프로젝트 경로>를 호출하면 프로젝트 단위 정보를 얻을 수 있습니다. 추가 인자를 생략하면 표준 출력으로, 경로를 지정하면 파일로 저장됩니다.

  • quarto: 사용 중인 Quarto 버전을 설명하는 객체
  • dir: 프로젝트가 위치한 디렉터리 경로
  • engines: 프로젝트에서 사용된 엔진 이름 배열
  • config: 프로젝트 설정 메타데이터(JSON)
  • files: 프로젝트 파일 정보를 담은 객체
    • input: 입력 파일 경로 배열
    • resources: 렌더링에 필요한 추가 리소스 경로 배열
    • config: 프로젝트 설정을 구성하는 YAML 파일 목록
    • configResources: 설정으로 인해 암시적으로 참조되는 리소스 경로 배열
  • fileInformation: 프로젝트가 렌더링할 각 문서에 대한 정보 객체. 키는 문서 경로이며 값은 다음 키를 포함하는 객체입니다.
    • includeMap: include 숏코드 사용을 나타내는 source, target 경로 배열
    • codeCells: 문서(및 include 대상)의 코드 셀 정보를 담은 객체 배열
      • start: 코드 셀 시작 줄
      • end: 코드 셀 마지막 줄
      • file: 코드 셀이 있는 파일 경로(Include로 인해 달라질 수 있음)
      • source: 코드 셀 내용
      • language: 코드 셀 언어
      • metadata: 코드 셀 메타데이터
  • extensions: 프로젝트에 설치된 확장 정보를 담은 객체 배열. 각 객체의 상세 구조는 Quarto 소스 코드의 TypeScript Extension 인터페이스를 따릅니다(필요 시 변경될 수 있음).

JSON 스키마

프로젝트 데이터

이 스키마는 별도 파일로도 제공됩니다.

{
    "type": "object",
    "title": "Project Information",
    "description": "Information about a Quarto project",
    "properties": {
        "quarto": {
            "type": "object",
            "properties": {
                "version": { "type": "string" }
            }
        },
        "dir": {
            "type": "string",
            "description": "The path of the project directory"
        },
        "engines": {
            "type": "array",
            "items": { "type": "string" },
            "description": "The engines used in the project"
        },
        "config": {
            "type": "object",
            "description": "Resolved project configuration in JSON format"
        },
        "files": {
            "type": "object",
            "properties": {
                "input": {
                    "type": "array",
                    "items": { "type": "string" },
                    "description": "The input files in the project"
                },
                "resources": {
                    "type": "object",
                    "properties": {
                        "type": "array",
                        "items": { "type": "string" },
                        "description": "The resource files explicitly provided in the project"
                    }
                },
                "configResources": {
                    "type": "object",
                    "properties": {
                        "type": "array",
                        "items": { "type": "string" },
                        "description": "The resource files implied by the project configuration"
                    }
                },
                "config": {
                    "type": "array",
                    "items": { "type": "string" },
                    "description": "The configuration files in the project"
                }
            }
        },
        "fileInformation": {
            "additionalProperties": {
                "type": "object",
                "properties": {
                    "includeMap": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "source": { "type": "string" },
                                "target": { "type": "string" }
                            }
                        }
                    },
                    "codeCells": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "start": { "type": "integer" },
                                "end": { "type": "integer" },
                                "file": { "type": "string" },
                                "source": { "type": "string" },
                                "language": { "type": "string" },
                                "metadata": { "type": "object" }
                            }
                        }
                    }
                }
            }
        },
        "extensions": { "type": "array", "items": { "type": "object" } }        
    }
}

문서 데이터

이 스키마 역시 별도 파일로 제공됩니다.

{
    "type": "object",
    "properties": {
        "quarto": {
            "type": "object",
            "properties": {
                "version": { "type": "string" }
            },
            "description": "The version of Quarto used to inspect the document"
        },
        "engines": {
            "type": "array",
            "items": { "type": "string" },
            "description": "The engines used in the document"
        },
        "formats": {
            "type": "object",
            "additionalProperties": { "type": "object" },
            "description": "An object representing the formats used in the document (keys) and their configuration (values)"
        },
        "resources": {
            "type": "array",
            "items": { "type": "string" },
            "description": "The resource files explicitly provided in the document"
        },
        "fileInformation": {
            "additionalProperties": {
                "type": "object",
                "properties": {
                    "includeMap": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "source": { "type": "string" },
                                "target": { "type": "string" }
                            }
                        }
                    },
                    "codeCells": {
                        "type": "array",
                        "items": {
                            "type": "object",
                            "properties": {
                                "start": { "type": "integer" },
                                "end": { "type": "integer" },
                                "file": { "type": "string" },
                                "source": { "type": "string" },
                                "language": { "type": "string" },
                                "metadata": { "type": "object" }
                            }
                        }
                    }
                }
            }
        },
        "project": {
            "$ref": "quarto-inspect-project-json-schema.json"
        }
    }
}