import re

from colorama import Fore
from colorama import Back
from colorama import Style
from colorama import init

import pydoc


init()


def handleTitle(text):
    return re.sub(
        '^#',
        Fore.RED + '#' + Style.RESET_ALL,
        text,
        flags=re.MULTILINE
    )


def handleTitle2(text):
    return re.sub(
        '(^#)',
        Fore.RED + r'\1' + Style.RESET_ALL,
        text,
        flags=re.MULTILINE
    )



test = Fore.RED + 'this is a test' + Style.RESET_ALL

title = """this is nothing
# find

next level"""

title = handleTitle2(title)

pydoc.pager(title)

@@ -34,34 +34,8 @@
 ore%0A
-from colorama import Back%0A
 from
@@ -111,106 +111,320 @@
 ()%0A%0A
-%0Adef handleTitle(text):%0A    return re.sub(%0A        '%5E#',%0A        Fore.RED + '#' + Style.RESET_ALL,
+COLOR_HASH = Fore.GREEN%0ACOLOR_HEADING = Fore.RED + Style.BRIGHT%0ACOLOR_CODE = Fore.RED%0ACOLOR_BACKTICK = Fore.RED%0A%0A%0Adef color_heading(text):%0A    return color_helper(%0A        text,%0A        '(%5E#)(.*)$',%0A        COLOR_HASH + r'%5C1' + COLOR_HEADING + r'%5C2'%0A    )%0A%0A%0Adef color_block_indent(text):%0A    return color_helper(
 %0A   
@@ -445,57 +445,235 @@
     
+ 
- flags=re.MULTILINE%0A    )%0A%0A%0Adef handleTitle2(text
+'%5E    (.*)$',%0A        COLOR_CODE + r'%5C1'%0A    )%0A%0A%0Adef color_backticks(text):%0A    %22%22%22untested%22%22%22%0A    return color_helper(%0A        text,%0A        '%5B%5E%60%5D+',%0A        COLOR_BACKTICK + r'%5C1'%0A    )%0A%0A%0Adef color_helper(text, pattern, repl
 ):%0A 
@@ -702,14 +702,15 @@
     
-'(%5E#)'
+pattern
 ,%0A  
@@ -719,24 +719,12 @@
     
-Fore.RED + r'%5C1'
+repl
  + S
@@ -788,17 +788,16 @@
     )%0A%0A%0A
-%0A
 test = F
@@ -904,20 +904,21 @@
 e = 
-handleTitle2
+color_heading
 (tit

add more color support