1 | {
|
2 | "title": "CodeBlock",
|
3 | "@id": "stencila:CodeBlock",
|
4 | "extends": "Code",
|
5 | "role": "secondary",
|
6 | "status": "stable",
|
7 | "category": "code",
|
8 | "description": "A code block.",
|
9 | "properties": {
|
10 | "type": {
|
11 | "@id": "schema:type",
|
12 | "description": "The name of the type.",
|
13 | "type": "string",
|
14 | "enum": [
|
15 | "CodeBlock",
|
16 | "CodeChunk"
|
17 | ],
|
18 | "default": "CodeBlock",
|
19 | "from": "Entity"
|
20 | },
|
21 | "id": {
|
22 | "@id": "schema:id",
|
23 | "description": "The identifier for this item.",
|
24 | "type": "string",
|
25 | "from": "Entity"
|
26 | },
|
27 | "meta": {
|
28 | "@id": "stencila:meta",
|
29 | "description": "Metadata associated with this item.",
|
30 | "type": "object",
|
31 | "from": "Entity"
|
32 | },
|
33 | "programmingLanguage": {
|
34 | "@id": "schema:programmingLanguage",
|
35 | "description": "The programming language of the code.",
|
36 | "type": "string",
|
37 | "from": "Code"
|
38 | },
|
39 | "format": {
|
40 | "@id": "schema:encodingFormat",
|
41 | "aliases": [
|
42 | "encoding",
|
43 | "encodingFormat"
|
44 | ],
|
45 | "description": "Media type, typically expressed using a MIME format, of the code.",
|
46 | "$comment": "This property allows the differentiation of formats using the same programming language\nor variants of a programming language. An example is using `programmingLanguage` \"json\" and\n`encodingFormat` \"application/ld+json\" for JSON-LD code examples.\n",
|
47 | "type": "string",
|
48 | "from": "Code"
|
49 | },
|
50 | "text": {
|
51 | "@id": "schema:text",
|
52 | "description": "The text of the code.",
|
53 | "type": "string",
|
54 | "from": "Code"
|
55 | },
|
56 | "exportFrom": {
|
57 | "@id": "stencila:exportFrom",
|
58 | "aliases": [
|
59 | "export"
|
60 | ],
|
61 | "description": "A compilation directive giving the name of the variable to export\ninto the content of the code block.\n",
|
62 | "type": "string",
|
63 | "from": "CodeBlock"
|
64 | },
|
65 | "importTo": {
|
66 | "@id": "stencila:importTo",
|
67 | "aliases": [
|
68 | "export"
|
69 | ],
|
70 | "description": "A compilation directive giving the name of the variable to import\nthe content of the code block as.\n",
|
71 | "type": "string",
|
72 | "from": "CodeBlock"
|
73 | }
|
74 | },
|
75 | "file": "CodeBlock.schema.yaml",
|
76 | "children": [
|
77 | "CodeChunk"
|
78 | ],
|
79 | "descendants": [
|
80 | "CodeChunk"
|
81 | ],
|
82 | "$schema": "http://json-schema.org/draft-07/schema#",
|
83 | "$id": "https://schema.stenci.la/v0/CodeBlock.schema.json",
|
84 | "source": "https://github.com/stencila/schema/blob/master/CodeBlock.schema.yaml",
|
85 | "type": "object",
|
86 | "propertyAliases": {
|
87 | "encoding": "format",
|
88 | "encodingFormat": "format",
|
89 | "export": "importTo"
|
90 | },
|
91 | "additionalProperties": false,
|
92 | "required": [
|
93 | "type",
|
94 | "text"
|
95 | ]
|
96 | }
|