MarkCraft - Markdown Editor
Version 1.0
A modern, fast, and intuitive Markdown editor, developed in B4J.
It combines a user-friendly text editor with a real-time HTML preview.
Main Features
Full Markdown Editor
- Formatting: bold, italic, strikethrough
- Headings H1 to H6
- Bulleted and Numbered Lists
- Quotations
- Tasks: - [ ] and - [x]
- Horizontal Lines
- Code Insertion (```)
Content Insertion
- Adding Links via a Dialog Box
- Adding Images with ALT + URL
- Auto-fill based on selection
Undo/Redo
- Custom Undo/Redo System
- History reset after each action
- Dedicated buttons with Font Awesome icons
Preview
- Real-time HTML preview
- Integrated WebView
- Instant Markdown rendering
- Two-way scroll synchronization
- Java ↔ JavaScript communication
File management
- Open a .md file
- Save as…
- Copy all Markdown to clipboard
- Automatic saving
Modern interface
- Font Awesome icons
- Compact toolbar
- Adjustable SplitPane
Technologies used
- B4J (RAD framework)
- JavaFX (UI + WebView)
- Font Awesome (icons)
- JavaScript for Markdown rendering
- HTML/CSS for the Preview
How it Works
- The user types Markdown in the TextArea.
- The text is sent to the WebView via JavaScript.
- The HTML is rendered instantly.
- Toolbar actions modify the text and update the preview.
- Undo/Redo allows for easy reverting.
View attachment 170042
Have fun !
I seem to have gotten an unexpected error in the code:
Dim js As String = $"showMarkdownFromJava('${cssEscaped}', '${mdEscaped}')"$
engine.RunMethod("executeScript", Array(js))
Waiting for debugger to connect...
Program started.
*** mainpage: B4XPage_Created
*** mainpage: B4XPage_Appear
*** mainpage: B4XPage_Resize [mainpage]
Error occurred on line: 1045 (B4XMainPage)
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:152)
at b4j.example.b4xmainpage._updatewebview(b4xmainpage.java:876)
at b4j.example.b4xmainpage._applytheme(b4xmainpage.java:658)
at b4j.example.b4xmainpage$ResumableSub_wv_PageFinished.resume(b4xmainpage.java:3095)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resumeAsUserSub(DebugResumableSub.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:632)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:234)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:117)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:104)
at anywheresoftware.b4a.shell.DebugResumableSub$DelegatableResumableSub.resume(DebugResumableSub.java:42)
at anywheresoftware.b4a.keywords.Common$2$1.run(Common.java:1106)
at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
at java.security.AccessController.doPrivileged(Native Method)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:185)
at java.lang.Thread.run(Thread.java:750)
Caused by: netscape.javascript.JSException: ReferenceError: Can't find variable: marked
at com.sun.webkit.dom.JSObject.fwkMakeException(JSObject.java:156)
at com.sun.webkit.WebPage.twkExecuteScript(Native Method)
at com.sun.webkit.WebPage.executeScript(WebPage.java:1543)
at javafx.scene.web.WebEngine.executeScript(WebEngine.java:1007)
... 32 more