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 摘要。