mirror of
https://github.com/apache/zeppelin
synced 2026-05-24 09:38:26 +00:00
### What is this PR for? This PR adds support for formatting math formula formatting in %html display system using MathJax library. ### What type of PR is it? Feature ### Todos * [x] - Format math formula with MathJax library ### What is the Jira issue? https://issues.apache.org/jira/browse/ZEPPELIN-777 ### How should this be tested? try run following codes. ``` %md When \\(a \\ne 0\\), there are two solutions to \\(ax^2 + bx + c = 0\\) and they are $$x = {-b \pm \sqrt{b^2-4ac} \over 2a}.$$ ``` Note MathJax works better with `markdown.parser.type` property set `pegdown`, in markdown interpreter. With default markdown4j parser, some formula is not well displayed. (for example, ax^2) I think this will not be a big problem because of we'll remove markdown4j https://github.com/apache/zeppelin/pull/1594 ``` %sh echo -e "%html \$\$a = b\$\$" ``` ``` %spark println("%html $$b = c$$") ``` ### Screenshots (if appropriate)  ### Questions: * Does the licenses files need update? yes * Is there breaking changes for older versions? no * Does this needs documentation? yes Author: Lee moon soo <moon@apache.org> Closes #1606 from Leemoonsoo/ZEPPELIN-777 and squashes the following commits:af8e079[Lee moon soo] Package MathJax resources2afedde[Lee moon soo] Fix typodd02bec[Lee moon soo] Add doc for mathmetical expression174d7ad[Lee moon soo] Add licensebb762c3[Lee moon soo] Format formula using MathJax
2.3 KiB
2.3 KiB
| layout | title | description | group |
|---|---|---|---|
| page | Basic Display System in Apache Zeppelin | There are 3 basic display systems in Apache Zeppelin. By default, Zeppelin prints interpreter responce as a plain text using text display system. With %html directive, Zeppelin treats your output as HTML. You can also simply use %table display system to leverage Zeppelin's built in visualization. | display |
{% include JB/setup %}
Basic Display System in Apache Zeppelin
Text
By default, Apache Zeppelin prints interpreter response as a plain text using text display system.
You can explicitly say you're using text display system.
Html
With %html directive, Zeppelin treats your output as HTML
Mathematical expressions
HTML display system automatically formats mathematical expression using MathJax. You can use
\\( INLINE EXPRESSION \\) and $$ EXPRESSION $$ to format. For example
Table
If you have data that row separated by '\n' (newline) and column separated by '\t' (tab) with first row as header row, for example
You can simply use %table display system to leverage Zeppelin's built in visualization.
If table contents start with %html, it is interpreted as an HTML.
Note : Display system is backend independent.