You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by zj...@apache.org on 2021/06/15 15:58:08 UTC

[zeppelin] branch master updated: [ZEPPELIN-5266]: Enable extension of flexmark in markdown interpreter

This is an automated email from the ASF dual-hosted git repository.

zjffdu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git


The following commit(s) were added to refs/heads/master by this push:
     new 70c0b98  [ZEPPELIN-5266]: Enable extension of flexmark in markdown interpreter
70c0b98 is described below

commit 70c0b98dfd6dd37a6d5302ec1738775d7dbc38b7
Author: EricGao888 <er...@gmail.com>
AuthorDate: Mon Jun 7 12:35:21 2021 +0800

    [ZEPPELIN-5266]: Enable extension of flexmark in markdown interpreter
    
    ### 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. :joy:
    
    ### 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 <er...@gmail.com>
    
    Closes #4130 from EricGao888/chufeng-fix-ZEPPELIN-5266 and squashes the following commits:
    
    ecd432dac [EricGao888] remove emoji images and use unicode instead
    ba35fc8ea [EricGao888] revert changes to karma.conf.js and package-lock.json
    5ab45a359 [EricGao888] ZEPPELIN-5266: Enable extension of flexmark in markdown interpreter
---
 .../java/org/apache/zeppelin/markdown/FlexmarkParser.java | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/markdown/src/main/java/org/apache/zeppelin/markdown/FlexmarkParser.java b/markdown/src/main/java/org/apache/zeppelin/markdown/FlexmarkParser.java
index f4de944..6dcbdeb 100644
--- a/markdown/src/main/java/org/apache/zeppelin/markdown/FlexmarkParser.java
+++ b/markdown/src/main/java/org/apache/zeppelin/markdown/FlexmarkParser.java
@@ -19,6 +19,7 @@ package org.apache.zeppelin.markdown;
 
 
 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;
@@ -32,6 +33,8 @@ import org.slf4j.LoggerFactory;
 
 import java.util.Arrays;
 
+import static com.vladsch.flexmark.ext.emoji.EmojiImageType.UNICODE_ONLY;
+
 /**
  * Flexmark Parser
  */
@@ -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();
   }