ipython / ipython/ipython-pygments-lexers

failure on shell commands after `%%time`

未关闭
#11 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Python
星标
0
派生
2
平均合并
12 天 21 小时
30 天内合并 PR
1

描述

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()))
```

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。