Skip to content

Commit

Permalink
feat(source map): Allow providing line and column
Browse files Browse the repository at this point in the history
  • Loading branch information
kylef authored and pksunkara committed Dec 4, 2017
1 parent c5a10d8 commit 4b9626d
Showing 1 changed file with 53 additions and 0 deletions.
53 changes: 53 additions & 0 deletions docs/element-definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,13 @@ series of bytes.
- (Array Element) - Continuous bytes block. A pair of byte index and byte count.
- `content` (array, fixed-type)
- ([Number Element][]) - Zero-based index of a byte in the source document.
- attributes
- line - The line number the source map starts on.
- column - The column number of the line that the source map starts on.
- ([Number Element][]) - Count of bytes starting from the byte index.
- attributes
- line - The line number the source map ends on.
- column - The column number of the line that the source map ends on.

#### Example

Expand Down Expand Up @@ -1652,6 +1658,53 @@ This reads, "The location starts at the 5th byte of the source file. It
includes the 12 subsequent bytes including the starting one. Then it
continues at the 21st byte for another 12 bytes."

#### Example

```json
{
"element": "sourceMap",
"content": [
{
"element": "array",
"content": [
{
"element": "number",
"attributes": {
"line": {
"element": "number",
"content": 3
},
"column": {
"element": "number",
"content": 2
}
},
"content": 4
},
{
"element": "number",
"attributes": {
"line": {
"element": "number",
"content": 3
},
"column": {
"element": "number",
"content": 10
}
},
"content": 12
}
]
}
]
}
```

This reads, "The location starts at the 5th byte (the 2nd byte of line 3) of the source file. It includes 12 bytes, until column 10 on line 3".

**NOTE** *`line` and `column` are optional and may not always be available*.

### Link Relations

In addition to conforming to [RFC 5988][] for link relations per the [base specification](https://github.com/refractproject/refract-spec/blob/master/refract-spec.md), there are also additional link relations
Expand Down

0 comments on commit 4b9626d

Please sign in to comment.