Skip to content

Commit

Permalink
Bold and italic buttons and variables linked up to apply_markdown_bot…
Browse files Browse the repository at this point in the history
…h_sides functions.
  • Loading branch information
hreikin committed Apr 3, 2022
1 parent 875c864 commit 47b8dc4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
23 changes: 19 additions & 4 deletions tkintermd/tkintermd_constants.py
Expand Up @@ -9,15 +9,30 @@
"- ", "> ", "# ", "`",
"--", ">> ", "## ",
"***", "___", "---", ">>> ", "### ", "```", "===",
"####", "#####", "######"
)
"####", "#####", "######",
)
italic_md_syntax = ("*", "_")
italic_md_ignore = (
"**", "__", "- ", "> ", "# ", "`",
"--", ">> ", "## ",
"***", "___", "---", ">>> ", "### ", "```", "===",
"####", "#####", "######"
)
"####", "#####", "######",
)
# Needs adjusting.
bold_italic_md_syntax = ("***", "___")
bold_italic_md_ignore = (
"*", "_", "- ", "> ", "# ", "`",
"**", "__", "--", ">> ", "## ",
"***", "___", "---", ">>> ", "### ", "```", "===",
"####", "#####", "######",
)
strikethrough_md_syntax = ("~~", "~~")
strikethrough_md_ignore = (
"*", "_", "- ", "> ", "# ", "`",
"**", "__", "--", ">> ", "## ",
"***", "___", "---", ">>> ", "### ", "```", "===",
"####", "#####", "######",
)

default_md_string = """
# Heading 1
Expand Down
9 changes: 5 additions & 4 deletions tkintermd/tkintermd_frame.py
Expand Up @@ -58,12 +58,13 @@ def __init__(self, master, **kwargs):
self.bold_btn.pack(side="left", padx=0, pady=0)
self.italic_btn = tk.Button(self.top_bar, text="Italic", command=lambda: self.apply_markdown_both_sides(constants.italic_md_syntax, constants.italic_md_ignore))
self.italic_btn.pack(side="left", padx=0, pady=0)
# self.bold_italic_btn = tk.Button(self.top_bar, text="Bold Italic")
# self.bold_italic_btn.pack(side="left", padx=0, pady=0)
# Currently has issues, needs constants adjusting.
self.bold_italic_btn = tk.Button(self.top_bar, text="Bold Italic", command=lambda: self.apply_markdown_both_sides(constants.bold_italic_md_syntax, constants.bold_italic_md_ignore))
self.bold_italic_btn.pack(side="left", padx=0, pady=0)
# self.heading_btn = tk.Button(self.top_bar, text="Heading")
# self.heading_btn.pack(side="left", padx=0, pady=0)
# self.strikethrough_btn = tk.Button(self.top_bar, text="Strikethrough")
# self.strikethrough_btn.pack(side="left", padx=0, pady=0)
self.strikethrough_btn = tk.Button(self.top_bar, text="Strikethrough", command=lambda: self.apply_markdown_both_sides(constants.strikethrough_md_syntax, constants.strikethrough_md_ignore))
self.strikethrough_btn.pack(side="left", padx=0, pady=0)
# self.unordered_list_btn = tk.Button(self.top_bar, text="Unordered List")
# self.unordered_list_btn.pack(side="left", padx=0, pady=0)
# self.ordered_list_btn = tk.Button(self.top_bar, text="Ordered List")
Expand Down

0 comments on commit 47b8dc4

Please sign in to comment.