Eclipse oxygen 内置 markdown 语法(源码-简单分析)

在最近安装了Eclipse oxygen,默认支持Markdown编写,就写了个md测试文档。结果,md的语法有一些居然不支持,在网上查找没有找到eclipse的默认插件说明。ps:也可能是我的方法不对。

在这里先放出本次操作软件的相关信息:

eclipse软件信息:Eclipse Platform Oxygen (4.7)     Build id: I20170612-0950

JAVA Decomplier(class反编译):JD-GUI 0.3.5    JD-Core 0.6.2

Luyten(class反编译,支持jdk8,并且在GitHub有源码):0.5.3

解释一下为什么要用两个反编译工具。

jd反编译,优点:可以打开多个jar,多个jar互为依赖时,可以快捷跳转,搜索功能很强大。缺点:不支持jdk最新的语法,好像还报错,只能查看class、properties等几种格式文档预览,好像不再更新了

Luyten反编译,优点:开源,有EXE、jar两种执行包,支持多种格式文档的预览,支持最新的jdk语法,代码预览主题样式可变换,持续更新中,等功能。缺点:不支持同时打开多个,不可以代码快捷跳转,跟踪java代码不方便。

同时都不没有中文汉化,luyten可以尝试本地汉化。

网络资料:

markdown文件的基本常用编写语法(图文并茂)

XML中的 "<" ">" "&" 怎么转义

Luyten源码

在Eclipse中结合Ant自动化帮助文档

使用Eclipse写帮助文档

开始放出eclipse内置Markdown的源码,通过源码解读支持的语法。

jar包是在eclipse安装根路径下的plugins文件夹内:

Eclipse oxygen 内置 markdown 语法(源码-简单分析)_第1张图片 wikitext插件包

发现了两个核心jar包和一个菜单UI包:


org.eclipse.mylyn.wikitext.markdown_3.0.6.20170311142502.jar

org.eclipse.mylyn.wikitext.markdown.ui_3.0.6.201703111926.jar

org.eclipse.mylyn.wikitext.ui_3.0.6.201703111926.jar


markdown.ui的包,内容比较少

Eclipse oxygen 内置 markdown 语法(源码-简单分析)_第2张图片 目录结构

MarkDown.md,实例文件

### Markdown Markup Cheat Sheet

#### Phrase Modifiers

\`\`inline code\`\` - rendered as ``inline code``  
\`inline code\` - rendered as `inline code`  
\*\*strong\*\* - rendered as **strong**  
\_\_strong\_\_ - rendered as __strong__  
\*emphasis\* - rendered as *emphasis*  
\_emphasis\_ - rendered as _emphasis_  

#### Block Modifiers

##### Code Blocks

To create a code block indent every line by 4 or more spaces, or by a tab.

	int x = 0; // example code block
	x = x + 1;

##### Paragraphs

Paragraphs are consecutive lines of text
separated by one or more blank lines.  End a line with two or
more spaces to create a line break. 

##### Headings

\# This is an H1  
\#\# This is an H2  
\#\# This is also an H2 \#\#    
\#\#\#\#\# This is an H5  

##### Lists

Unordered lists use `*`, `+`, or `-` as bullets.

*   one
*   two

Numbered lists use numbers followed by periods:

1.  one
2.  two

##### Block Quotes

> Block quotes use email-style quoting  
> second quoted line

##### Horizontal Rule

A horizontal rule is created with 3 or more hyphens or stars on a line.

\-\-\-  
\*\*\*

#### Links

<http://www.example.com>  - rendered as   
\[Text\]\(http://www.example.com "Optional title"\) - rendered as [Text](http://www.example.com "Optional title")  
\[an example\]\[id\] - rendered as [an example][id]

##### Link Reference Definition

[id]: http://example.com/  \"Optional Title Here\"

#### Images

\!\[Alt text\]\(path/to/image.png "Optional title"\)  
\!\[Alt text\]\[Reference ID\]

#### HTML Tags

All HTML tags are recognized
 
<tt>teletype</tt> - teletype

#### Reference 

[Complete Markdown syntax guide](http://daringfireball.net/projects/markdown/syntax)

about.html,介绍




About



About This Content

June 25, 2008

License

The Eclipse Foundation makes available all content in this plug-in ("Content"). Unless otherwise indicated below, the Content is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is available at http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program" will mean the Content.

If you did not receive this Content directly from the Eclipse Foundation, the Content is being redistributed by another party ("Redistributor") and different terms and conditions may apply to your use of any object code in the Content. Check the Redistributor's license that was provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise indicated below, the terms and conditions of the EPL still apply to any source code in the Content and such source code may be obtained at http://www.eclipse.org.

plugin.properties,属性配置

###############################################################################
# Copyright (c) 2012, 2013 Stefan Seelmann and others.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Eclipse Public License v1.0
# which accompanies this distribution, and is available at
# http://www.eclipse.org/legal/epl-v10.html
#
# Contributors:
#     Stefan Seelmann - initial API and implementation
###############################################################################

Bundle-Vendor.0 = Eclipse Mylyn
Bundle-Name.0 = Mylyn WikiText Markdown UI

content-type.name = Markdown WikiText Markup

template.description.br = line break
template.description.h1 = Heading 1
template.description.h2 = Heading 2
template.description.h3 = Heading 3
template.description.h4 = Heading 4
template.description.h5 = Heading 5
template.description.h6 = Heading 6
template.description.lb = List (bulleted)
template.description.ln = List (numeric)
template.description.bq = Block quote
template.description.li = Link (inline) - [Text](http://www.example.com "Optional title")
template.description.lr = Link (footnote) - [Text][id]
template.description.ls = Link (simple) - 
template.description.ii = Image (inline) - ![Alt text](path/to/image.png "Optional title")
template.description.ir = Image (footnote) - ![Alt text][id]

plugin.xml,配置文件。