Fix: Allow passing integers for floats by aymeric-roucher 路 Pull Request #1623 路 huggingface/smolagents (original) (raw)
This prevents automatic number highlighting, such as the highlighting of "Step {step_number}" in rules. It does not affect code highlighting. To test it, run this script:
from rich import box from rich.console import Console from rich.markdown import Markdown from rich.panel import Panel from rich.syntax import Syntax
console = Console()
Disable automatic syntax highlighting for numbers
console = Console(highlight=False)
You can still use markdown
markdown = Markdown("Bold and italic text") console.print(markdown)
Regular text won't have syntax highlighting
console.print("Numbers 123 and 456 won't be colored")
console.print( Panel( Syntax( "print('Hello, world!')", lexer="python", theme="monokai", word_wrap=True, ), title="[bold]" + "Example", title_align="left", box=box.HORIZONTALS, ) )