Skip to content

PyBemolle is a Pygments library plugin made to colorize guitar chords.

License

Notifications You must be signed in to change notification settings

ihor-nahuliak/pybemolle

Repository files navigation

pybemolle

Build Status Coverage Status

PyBemolle is a pygments library plugin made to colorize guitar chords

This is an example of how this library works:

pybemolle

Quickstart

Install pygments and pybemolle lib into your python environment:

pip install pygments && pip install pybemolle

Make test.bemolle file:

;;  A                            Asus4   A
    Deep down Louisiana close to New   Orleans
;;                                     Asus4 A
    Way back up in the woods among the ever  greens
;;        D
    There stood a log cabin made of earth and wood
;;        A                         Asus4     A
    Where lived a country boy named Johnny B. Goode
;;      E                             E7*      E
    Who never ever learned to read or write so well
;;               A                           Asus4     A
    But he could play the guitar just like a ringing a bell
 
;;  A
    Go go, Go Johnny go go, Go Johnny go
;;  D
    Go, Go Johnny go
;;  A
    Go, Go Johnny go
;;  E  E7          A
    Go,Johnny B. Goode

Compile it to html code using pygments tool:

pygmentize -f html -O full -o test.html test.bemolle

Enjoy!

Advanced usage

The same example using python code:

from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import get_formatter_by_name


song = '''
;;  A                            Asus4   A
    Deep down Louisiana close to New   Orleans
;;                                     Asus4 A
    Way back up in the woods among the ever  greens
;;        D
    There stood a log cabin made of earth and wood
;;        A                         Asus4     A
    Where lived a country boy named Johnny B. Goode
;;      E                             E7*      E
    Who never ever learned to read or write so well
;;               A                           Asus4     A
    But he could play the guitar just like a ringing a bell
 
;;  A
    Go go, Go Johnny go go, Go Johnny go
;;  D
    Go, Go Johnny go
;;  A
    Go, Go Johnny go
;;  E  E7          A
    Go,Johnny B. Goode
'''

lexer = get_lexer_by_name('bemolle', stripall=True)
formatter = get_formatter_by_name('html')
result = highlight(song, lexer, formatter)

About

PyBemolle is a Pygments library plugin made to colorize guitar chords.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published