ipython / ipython/ipython-pygments-lexers

failure on shell commands after `%%time`

Open
#11 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
0
Forks
2
Avg merge
12d 21h
Merged PRs (30d)
1

Description

Hi, thanks for your work!

I encountered the following issue when using this lexer to highlight the contents of a jupyter notebook cell.

```ipython
%%time
!run_command
```
This should time the runtime of `run_command`, but instead it fails on `!` because the lexer assumes that whatever comes after `%%time` should be handled by the normal python lexer.

Reproducing snippet:
```python
from pygments import highlight
from pygments.formatters import TerminalFormatter
from pygments.lexers import get_lexer_by_name

lexer = get_lexer_by_name("ipython3")
code = "%%time\n!cmd"
print(highlight(code, lexer, TerminalFormatter()))
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.