Skip to content

Commit

Permalink
[ZEPPELIN-5266]: Enable extension of flexmark in markdown interpreter
Browse files Browse the repository at this point in the history
### What is this PR for?
* Enable extension of flexmark in markdown interpreter

### What type of PR is it?
Improvement

### Todos
* [ ] - Make emoji auto-scale according to the size of text

### What is the Jira issue?
* https://issues.apache.org/jira/browse/ZEPPELIN-5266

### How should this be tested?
* Create a cell of markdown type, set the interpreter to be flexmark and type in an emoji code, e.g. 😂

### Screenshots (if appropriate)
![image](https://user-images.githubusercontent.com/34905992/120780755-fef30500-c55a-11eb-9c58-a06c5e9f72d1.png)
![image](https://user-images.githubusercontent.com/34905992/120780771-01555f00-c55b-11eb-900c-aff350049818.png)

### Questions:
* None

Author: EricGao888 <[email protected]>

Closes apache#4130 from EricGao888/chufeng-fix-ZEPPELIN-5266 and squashes the following commits:

ecd432d [EricGao888] remove emoji images and use unicode instead
ba35fc8 [EricGao888] revert changes to karma.conf.js and package-lock.json
5ab45a3 [EricGao888] ZEPPELIN-5266: Enable extension of flexmark in markdown interpreter
  • Loading branch information
EricGao888 authored and zjffdu committed Jun 15, 2021
1 parent 3b9cfbf commit 70c0b98
Showing 1 changed file with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@


import com.vladsch.flexmark.ext.autolink.AutolinkExtension;
import com.vladsch.flexmark.ext.emoji.EmojiExtension;
import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension;
import com.vladsch.flexmark.ext.tables.TablesExtension;
import com.vladsch.flexmark.ext.typographic.TypographicExtension;
Expand All @@ -32,6 +33,8 @@

import java.util.Arrays;

import static com.vladsch.flexmark.ext.emoji.EmojiImageType.UNICODE_ONLY;

/**
* Flexmark Parser
*/
Expand All @@ -43,12 +46,14 @@ public class FlexmarkParser implements MarkdownParser {
public FlexmarkParser() {
MutableDataSet options = new MutableDataSet();
options.set(Parser.EXTENSIONS, Arrays.asList(StrikethroughExtension.create(),
TablesExtension.create(),
UMLExtension.create(),
AutolinkExtension.create(),
WikiLinkExtension.create(),
TypographicExtension.create()));
TablesExtension.create(),
UMLExtension.create(),
AutolinkExtension.create(),
WikiLinkExtension.create(),
TypographicExtension.create(),
EmojiExtension.create()));
options.set(HtmlRenderer.SOFT_BREAK, "<br />\n");
options.set(EmojiExtension.USE_IMAGE_TYPE, UNICODE_ONLY);
parser = Parser.builder(options).build();
renderer = HtmlRenderer.builder(options).build();
}
Expand Down

0 comments on commit 70c0b98

Please sign in to comment.