This tool helps you safely prepare source code for publishing on Blogger. You paste your code, press the convert button, and the app instantly transforms it into a format that displays correctly without being interpreted or altered by the platform. It keeps your code clean, readable, and protected. After conversion, you can copy the final result and insert it directly into your blog. It’s a fast and reliable solution for developers who want to share code snippets online.

import html
import tkinter as tk
from tkinter import ttk, messagebox
def paste_from_clipboard():
try:
text_input.insert(tk.INSERT, root.clipboard_get())
except Exception:
try:
text_input.focus_set()
text_input.event_generate("<<Paste>>")
except Exception:
pass
def process_code():
raw_code = text_input.get("1.0", tk.END).strip()
if not raw_code:
return
try:
# 1. Escapam caracterele speciale HTML (<, >, &, ")
escaped_code = html.escape(raw_code)
# 2. Includem codul convertit in structura div -> pre -> code
formatted_result = f"<div><pre><code>{escaped_code}</code></pre></div>"
# 3. Afisam rezultatul
text_output.config(state=tk.NORMAL)
text_output.delete("1.0", tk.END)
text_output.insert(tk.END, formatted_result)
text_output.config(state=tk.DISABLED)
except Exception as e:
messagebox.showerror("Eroare", f"A aparut o eroare la conversie: {e}")
def copy_to_clipboard():
cleaned_text = text_output.get("1.0", tk.END).strip()
if cleaned_text:
try:
root.clipboard_clear()
root.clipboard_append(cleaned_text)
messagebox.showinfo("OK", "Copiat in clipboard!")
except Exception as e:
messagebox.showerror("Eroare", f"Nu s-a putut copia: {e}")
def clear_all():
text_input.delete("1.0", tk.END)
text_output.config(state=tk.NORMAL)
text_output.delete("1.0", tk.END)
text_output.config(state=tk.DISABLED)
# Constructie Interfata
root = tk.Tk()
root.title("Code Escaper for Blogger")
root.geometry("400x600")
# Input
lbl1 = ttk.Label(root, text="1. Cod Sursa de Convertit:")
lbl1.pack(anchor="w", padx=10, pady=(10, 0))
frame_btns = ttk.Frame(root)
frame_btns.pack(fill=tk.X, padx=10, pady=5)
btn_paste = ttk.Button(frame_btns, text="Lipeste (Paste)", command=paste_from_clipboard)
btn_paste.pack(side=tk.LEFT, fill=tk.X, expand=True, padx=(0, 5))
btn_clear = ttk.Button(frame_btns, text="Sterge", command=clear_all)
btn_clear.pack(side=tk.RIGHT)
text_input = tk.Text(root, height=8)
text_input.pack(fill=tk.BOTH, expand=True, padx=10, pady=5)
# Procesare
btn_process = ttk.Button(root, text="Converteste pentru Blogger", command=process_code)
btn_process.pack(fill=tk.X, padx=10, pady=5)
# Output
lbl2 = ttk.Label(root, text="2. Rezultat de pus in Blogger:")
lbl2.pack(anchor="w", padx=10, pady=(5, 0))
text_output = tk.Text(root, height=8, state=tk.DISABLED)
text_output.pack(fill=tk.BOTH, expand=True, padx=10, pady=5)
btn_copy = ttk.Button(root, text="Copiaza Rezultatul", command=copy_to_clipboard)
btn_copy.pack(fill=tk.X, padx=10, pady=(5, 10))
root.mainloop()