Imran Ali
Imran Ali

Reputation: 2279

How to reference a fenced code block in pandoc markdown?

I have written a document in markdown, and I am having problem referencing a fenced code block. When I write the block as

```sql
SELECT Name
FROM STUDENT 
WHERE Id = 987654321
```

and compile to pdf format with pandoc. The output looks like the image below

enter image description here

I want to be able to reference it, so reading the docs I changed the code block like this:

```{#query1, .sql}
SELECT Name
FROM STUDENT 
WHERE Id = 987654321
```

Now compiling again gives the following: (I have tried compiling with and without --listing option)

enter image description here

which does not look good and also does not help in referencing to the code block.

I am using pandoc 2.5, and vim-pandoc, vim-pandoc-syntax plugins with vim 8.2 on Focal Fossa.

Upvotes: 1

Views: 1142

Answers (1)

tarleb
tarleb

Reputation: 22609

There must be no comma between the id and the class:

```{#query1 .sql}
SELECT Name
FROM STUDENT 
WHERE Id = 987654321
```

Upvotes: 1

Related Questions