Skip to content

Commit

Permalink
Change info in Code to meta
Browse files Browse the repository at this point in the history
Related to GH-22.
Related to d797ea3.
  • Loading branch information
wooorm committed Aug 20, 2018
1 parent 7496bbe commit 5bf6788
Showing 1 changed file with 26 additions and 7 deletions.
33 changes: 26 additions & 7 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,17 +157,15 @@ Yields:
### `Code`

`Code` ([`Text`][text]) occurs at block level (see
[`InlineCode`][inlinecode] for code spans). `Code` supports an
info string and a language tag (when the line with the opening fence
contains some text, it is stored as the info string, the first word
following the fence is stored as the language tag, the rest of the
line is stored as the info string, both are null if missing)
[`InlineCode`][inlinecode] for code spans). The value after the opening
of fenced code can be followed by a language tag, and then optionally
white-space followed by the meta value.

```idl
interface Code <: Text {
type: "code";
lang: string | null;
info: string | null;
meta: string | null;
}
```

Expand All @@ -183,11 +181,32 @@ Yields:
{
"type": "code",
"lang": null,
"info": null,
"meta": null,
"value": "foo()"
}
```

And the following markdown:

````md
```js highlight-line="2"
foo()
bar()
baz()
```
````

Yields:

```json
{
"type": "code",
"lang": "js",
"meta": "highlight-line=\"2\"",
"value": "foo()\bbar()\nbaz()"
}
```

### `InlineCode`

`InlineCode` ([`Text`][text]) occurs inline (see [`Code`][code] for
Expand Down

0 comments on commit 5bf6788

Please sign in to comment.