Ahoj,

Dňa Wed, 15 Sep 2021 00:36:26 +0900 Komiya Takeshi
<[email protected]> 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

-- 
You received this message because you are subscribed to the Google Groups 
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sphinx-users/20210914184110.782231ec%40bonifac.skk.

Attachment: pgpHFRAv7e_eE.pgp
Description: Digitálny podpis OpenPGP

Reply via email to