Share My Creation MarkCraft - Markdown Editor

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
  1. The user types Markdown in the TextArea.
  2. The text is sent to the WebView via JavaScript.
  3. The HTML is rendered instantly.
  4. Toolbar actions modify the text and update the preview.
  5. Undo/Redo allows for easy reverting.

ScreenShot.png


Have fun !
 

Attachments

  • lib.png
    lib.png
    2 KB · Views: 38
  • MarkdownFileTest.zip
    3.7 KB · Views: 49
  • MarkCraft.zip
    214.1 KB · Views: 4
Last edited:

Toley

Active Member
Licensed User
Longtime User
Thank you will be very useful. I have this error when compiling in B4J

B4X:
B4J Version: 10.30
Parsing code.    (0.04s)
    Java Version: 19
Building folders structure.    (0.02s)
Running custom action.    (0.05s)
Compiling code.    (0.23s)
Compiling layouts code.    (0.02s)
Organizing libraries.    (0.00s)
Compiling generated Java code.    Error
src\b4j\example\b4xmainpage.java:1645: error: method _webscroll in class b4xmainpage cannot be applied to given types;
    _webscroll(null, s);    // lazy way to call sub
    ^
  required: String
  found:    <null>,String
  reason: actual and formal argument lists differ in length
1 error

javac 19.0.2

Edit: Happens only on release on debug it run fine thank you.
 
Last edited:

zed

Well-Known Member
Licensed User
Replace the Java code with this one.
JAVA:
#if java
import javafx.scene.web.*;
import javafx.event.*;

public void setAlertHandler(WebView wv) {

 wv.getEngine().setOnAlert(new EventHandler<WebEvent<String>>(){

            @Override
            public void handle(WebEvent<String> arg0) {          
               caller(arg0.getData());
            }

        });
}
public void caller(String s){
    try{
    _webscroll(s);    // lazy way to call sub
    } catch (Exception e) {
    }
}
#End If

_webscroll(null,s); It asked for two parameters, but we only passed one.
 

Grinaute

Member
Licensed User
Longtime User
Hi Paul,
I replaced it with:
B4X:
public void caller(String s){
    try{
        getBA().raiseEventFromUI(this, ‘webscroll’, s);
    } catch (Exception e) {
    }
}

and no more problems in Release mode (obfuscated). If that helps...
 

zed

Well-Known Member
Licensed User

Version1.3
update in post #1

ADD Mapping CTRL+

Fonction MarkdownShortcut CTRLLogic
Title (H1–H6)CTRL + 1,,,6H = Heading
BoldCTRL + BStandard
ItalicCTRL + IStandard
CrossedOutCTRL + DD = Delete visual
Code blockCTRL + GG = Gros code (block)
Citation (>)CTRL + QQ = Quote
Simple list (•)CTRL + LL = List
Numbered list (1.)CTRL + NN = Numbered
LinkCTRL + KStandard
ImageCTRL + MM = Media
TaskEmpty [- ]CTRL + TT = Task
TaskDone [x]CTRL + FF = Finish
Horizontal line (---)CTRL + RR = Rule (ligne)

Java bug fix - Tank’s Grinaute

Why null instead of this?

Because raiseEventFromUI(this, …) assumes that "this" is a valid B4J module. But in this case, "this" refers to the Java class, not the B4J module.
So for some users, it works by chance, and for others, it crashes because B4J can't find the correct instance.
By setting null, B4J automatically searches for the correct module containing the webscroll sub.
If I'm wrong, please tell me
 
Last edited:
Top