Ahoj,
Dňa Wed, 15 Sep 2021 00:36:26 +0900 Komiya Takeshi
<
i.tk...@gmail.com> napísal:
> On the other hand, in bash's case, it can't recognizes "$" as a
> prompt. So there is no special styles on the output.
>
> $ echo '$ A prompt' | pygmentize -l bash -f html
> <div class="highlight"><pre><span></span>$ A prompt
> </pre></div>
>
> So some contribution would be needed for pygments, I think.
I afraid, that it will be hard to implement in some generic way, as the
prompt are less standardized than in python.
But one can customize the bash lexer in sphinx to use exact prompts. I
have no example, i never play with bash lexer, but sphinx has
documented pygments API (or how ot name it) and i use some customized
lexers, e.g. for arduino code:
class AvrArduinoLexer(ArduinoLexer):
"""Extended Arduino lexer class
"""
constants = CONSTANTS
functions = ArduinoLexer.functions | {"ISR", "_delay_ms"}
def setup(app):
"""extension's setup
"""
app.add_lexer("arduino", AvrArduinoLexer)
--
Slavko
http://slavino.sk