Skip to content

Commit

Permalink
Use original content which preserves indentation
Browse files Browse the repository at this point in the history
  • Loading branch information
sourishkrout committed Oct 31, 2022
1 parent 180af3d commit 8f4d09a
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,5 @@ openssl rand -base64 32
These are shown as simple markdown, e.g:

```py { readonly=true }
print("Hello World")
print("Hello World")
```
3 changes: 2 additions & 1 deletion src/extension/notebook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ export class Serializer implements vscode.NotebookSerializer {
*/
acc.push(cell)
} else if (s.language) {
const mdContent = s.content ?? (s.lines || []).join('\n').trim()
const cell = new vscode.NotebookCellData(
vscode.NotebookCellKind.Markup,
`\`\`\`${s.language}\n${(s.lines || []).join('\n').trim()}\n\`\`\``,
`\`\`\`${s.language}\n${mdContent}\n\`\`\``,
'markdown'
)
cell.metadata = { id: i }
Expand Down

0 comments on commit 8f4d09a

Please sign in to comment.