GSoC/2019/StatusReports/SonGeon

From KDE Community Wiki
< GSoC‎ | 2019‎ | StatusReports

kmarkdown-qtview with WYSIWYG markdown editor

Details about project

kmarkdown-qtview project detail

First, most markdown editors are using webview based renderer. But webview based editors have the lack of printing options. Because Markdown is aiming to make a good looking document with simple text notations on the web environment. In a single webpage, It doesn’t have pagination for printing.

So webview based renders have the same problems. For example, document elements are printed across multiple pages and the document’s paragraphs, word spacing, and line spacing are slightly different compared to the screen. If the markdown editor support the preview of the paging, better text rendering with the layout of printing, It will be more powerfull like word processors.

Second, the KDE project already has the markdown renderer kmarkdownWebview. Currently, It has a forked third-party javascript library for markdown rendering. I want to minimize the dependencies. And It use the Qt’s QWebEngine and QWebChannel. Those are used to run a JS library and It brings a lot of overhead.

I think writing new renderer using Qt API and C++ without a third-party library is a lighter approach. So I choose to make parser with the Boost Spirit. It’s the PEG parser generator implemented in the boost library and It’s super fast.

Final Progress

1. Parsing Part

  • Done : basic emphasizes (bold, cancle.. ETC), header, link, blockquote
  • ToDo : list, refactoring the ast to regenerate string


2. Viewer Part

  • Done : emphasize, header, link, blockquote, wsiwyg for emphasizes
  • ToDo : find effective way to regenerate string, html insertion, stylesheet


3. ReadWrite Part

  • Done : viewer, editing
  • ToDo : save

Source Code

go to cgit.kde.org

Dependency

  • Qt5
  • Boost > 1.69
  • KParts

How To Use

1. git clone git://anongit.kde.org/scratch/songeon/kmarkdownparser.git

2. cmake ./

3. make; mv libkmarkdownparserpart.so shellexample/

4. cd shellexample

Work report

2019-08-22 change string generation from ast

2019-08-21 change emphasize string generation part.

2019-08-20 add wiswyg features for ephasizes

2019-08-18 split the link to hyperlink and image link. and make ast::string to include the ast::emphasizeString to reduce the redundant codes.

2019-08-16 refactor the code and change the attribute rendering to insert the html code

2019-08-15 add link

2019-08-10 add concurrent parsing

2019-08-7 change the document's rendering working not include the tokens

2019-07-25 add blockquote add attribute types for the tokens

2019-07-25 change postagging to use c++ 2017 auto template and constexpr

2019-07-23 add position tag in the token

2019-07-22 add cancleline and change code to use tokens

2019-07-16 make simple shell program. Thanks to Eike

2019-07-16 add kpart implementation

2019-07-09 refactor ast structure

2019-06-29 Make Header view

2019-06-25 start make a qt view

2019-06-20 Make Idea about new structure

2019-06-10 add licensing header on source code

2019-06-05 add EmphasizedString for parsing text with emphasize tokens

2019-06-05 basic project structure

Links to Blogs and other writing

My Blog link : jen6.github.io


1. First GSOC Project Introduction

On this summer I’m working with the KDE community by participating the “Google Summer of Code” Program. My main goal during GSOC period is making a markdown view, WYSIWIG editor using C++ and Qt. There were two reasons that I started to make a new markdown view. First, most markdown editors are using webview based renderer. But webview based editors have the lack of printing options. Because Markdown is aiming to make a good looking document with simple text notations on the web environment. In a single webpage, It doesn’t have pagination for printing. ...

2. First week of GSOC, Piece Table Implement

first, I started to make the markdown parser using the Boost Spirit X3. Spirit makes easy to express grammar using the PEG. But it’s templet based library so it was hard to find out which part is wrong. Also documentation of spirit was limited. So I had a lots of trial and error to get compilable source code....