Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
quarto-dev
GitHub Repository: quarto-dev/quarto-cli
Path: blob/main/tests/docs/playwright/ojs/errors/test-yaml-offset.qmd
3563 views
---
title: "ojs syntax error"
format: html
code-tools: true
---

## Let's add some knitr line number interference

This should make it harder for the lines to come out right:

```{r}
rnorm(100)
```

## Syntax Errors in cell with YAML

```{ojs}
//| echo: true


// Let's forget this is JS to force a syntax error
viewof x = Inputs.range([0, 100], line22 = "hello!", value = 20)
```

### Fenced test

```{ojs}
//| echo: fenced


300 + 50
forceError_line_32
"good output 2"
forceError_line_34
```

```{ojs}
//| echo: fenced
//| some-yaml-to: ignore
300 + 50
forceError_line_41
"good output 2"
forceError_line_43
```

### non-fenced test

```{ojs}
//| echo: true
300 + 50
forceError_line_51
"good output 2"
forceError_line_53
```

```{ojs}
//| echo: true


forceError_line_60
forceError_line_61
"good output 2"
forceError_line_63
```

## Errors in cells with varying amounts of YAML

```{ojs}
import { aq, op, badImportOnLine70 } from '@uwdata/arquero'
badImportOnLine70
```

```{ojs}


// Let's forget this is JS to force a syntax error
viewof x = Inputs.range([0, 100], line77 = "hello!", value = 20)
```

```{ojs}
//| some: yaml


// Let's forget this is JS to force a syntax error
viewof x = Inputs.range([0, 100], line85 = "hello!", value = 20)
```

```{ojs}
//| some: yaml
//| more: yaml


// Let's forget this is JS to force a syntax error
viewof x = Inputs.range([0, 100], line94 = "hello!", value = 20)
```


## Runtime errors with varying amounts of yaml and whitespace

```{ojs}
line_101
```

```{ojs}
//| echo: true
line_106
```

```{ojs}
//| echo: true
//| more: yaml
line_112
```

```{ojs}

line_117
```

```{ojs}
//| echo: true

line_123
```

```{ojs}
//| echo: true
//| more: yaml

line_130
```

```{ojs}


line_136
```

```{ojs}
//| echo: true


line_143
```

```{ojs}
//| echo: true
//| more: yaml


line_151
```

## Runtime errors with varying amounts of yaml and whitespace and multiple values

```{ojs}
line_157
line_158 = 1
line_159
```

```{ojs}
//| echo: true
line_164
line_165 = 1
line_166
```

```{ojs}
//| echo: true
//| more: yaml
line_172
line_173 = 1
line_174
```

```{ojs}

line_179
line_180 = 1
line_181
```

```{ojs}
//| echo: true

line_187
line_188 = 1
line_189
```

```{ojs}
//| echo: true
//| more: yaml

line_196
line_197 = 1
line_198
```

```{ojs}


line_204
line_205 = 1
line_206
```

```{ojs}
//| echo: true


line_213
line_214 = 1
line_215
```

```{ojs}
//| echo: true
//| more: yaml


line_223
line_224 = 1
line_225
```