Skip to content

Commit

Permalink
add allow namespace to HTML parser.
Browse files Browse the repository at this point in the history
  • Loading branch information
vsch committed Jan 30, 2022
1 parent 2b0cadf commit 5d8ccbc
Show file tree
Hide file tree
Showing 78 changed files with 445 additions and 129 deletions.
13 changes: 0 additions & 13 deletions .idea/libraries/Maven__junit_junit_4_12.xml

This file was deleted.

17 changes: 17 additions & 0 deletions .idea/libraries/Maven__junit_junit_4_13.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion .idea/markdown-navigator.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 14 additions & 3 deletions VERSION.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,16 @@ Please give feedback on the upcoming changes if you have concerns about breaking

* Fix: update OpenHtmlToPDF to 1.0.10
* Fix: update jsoup to 1.14.3
* Fix: update junit to 4.13.2
* Fix: Remove deprecated `of()` sequence methods.
* Fix: [#452, JiraConverter: Mixed lists rendered incorrectly], thanks to
**[znerd](https://github.com/znerd)**
* Fix: merge [#489, add flexmark-ext-resizable-image] thanks to
**[sparksparrow](https://github.com/sparksparrow)**
* Fix: [#482, Namespaces in embedded HTML blocks not supported?]
* Add `Parser.HTML_ALLOW_NAME_SPACE`, default `false` to allow recognizing HTML elements with
namespace prefix. :exclamation: HTML deep parser always allows namespaces and ignores this
option.

## 0.62.4

Expand Down Expand Up @@ -214,7 +223,7 @@ Please give feedback on the upcoming changes if you have concerns about breaking

## 0.61.30

* Fix: [#402, When using PegdownOptionsAdapter indented code blocks does not work for lists]
* Fix: [#452, JiraConverter: Mixed lists rendered incorrectly]

## 0.61.28

Expand Down Expand Up @@ -339,7 +348,7 @@ Please give feedback on the upcoming changes if you have concerns about breaking
* Deprecate: `JekyllTagExtension.ENABLE_RENDERING`, not used nor needed.
* Fix: [#398, Autolinks get cut off if they contain \`&\` (escaped query params)]

## 0.61.10
## 0.61.10

* Add: `HtmlRenderer.FENCED_CODE_LANGUAGE_DELIMITERS`, default `" \t"`, to configure which chars
terminate the language part of info string
Expand Down Expand Up @@ -2154,6 +2163,8 @@ Please give feedback on the upcoming changes if you have concerns about breaking
[#397, PR: Add base64 image support with docx rendering]: https://github.com/vsch/flexmark-java/pull/397
[#398, Autolinks get cut off if they contain \`&\` (escaped query params)]: https://github.com/vsch/flexmark-java/issues/398
[#407, Link text inline content fails to parse image references]: https://github.com/vsch/flexmark-java/issues/407
[#452, JiraConverter: Mixed lists rendered incorrectly]: https://github.com/vsch/flexmark-java/issues/452
[#489, add flexmark-ext-resizable-image]: https://github.com/vsch/flexmark-java/issues/489
[@Xaelis]: https://github.com/Xaelis
[Awesome Console]: https://plugins.jetbrains.com/plugin/7677-awesome-console "Awesome Console"
[HtmlToMarkdownCustomizedSample.java]: https://github.com/vsch/flexmark-java/blob/master/flexmark-java-samples/src/com/vladsch/flexmark/java/samples/HtmlToMarkdownCustomizedSample.java
Expand All @@ -2164,6 +2175,6 @@ Please give feedback on the upcoming changes if you have concerns about breaking
[migrate 0_35_x to 0_40_0.xml]: /assets/migrations/migrate%20flexmark-java%200_35_x%20to%200_40_0.xml
[migrate flexmark-java 0_40_x to 0_42_0]: https://github.com/vsch/flexmark-java/blob/master/assets/migrations/migrate%20flexmark-java%200_40_x%20to%200_42_0.xml
[migrate flexmark-java 0_42_x to 0_50_0.xml]: https://github.com/vsch/flexmark-java/blob/master/assets/migrations/migrate%20flexmark-java%200_42_x%20to%200_50_0.xml
[#482, Namespaces in embedded HTML blocks not supported?]: https://github.com/vsch/flexmark-java/issues/482
[#402, When using PegdownOptionsAdapter indented code blocks does not work for lists]: https://github.com/vsch/flexmark-java/issues/402
2 changes: 1 addition & 1 deletion flexmark-core-test/flexmark-core-test.iml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@
<orderEntry type="library" name="apache.logging.log4j.core" level="project" />
<orderEntry type="library" name="Maven: net.sf.jopt-simple:jopt-simple:4.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-math3:3.2" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" name="Maven: junit:junit:4.13" level="project" />
</component>
</module>
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@

import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.notNullValue;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.*;

final public class ParserTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ public abstract class CoreRendererSpecTest extends RendererSpecTest {
optionsMap.put("block-quote-extend", new MutableDataSet().set(Parser.BLOCK_QUOTE_EXTEND_TO_BLANK_LINE, true));
optionsMap.put("block-ignore-blank", new MutableDataSet().set(Parser.BLOCK_QUOTE_IGNORE_BLANK_LINE, true));
optionsMap.put("html-block-start-only-on-block-tags", new MutableDataSet().set(Parser.HTML_BLOCK_START_ONLY_ON_BLOCK_TAGS, true));
optionsMap.put("no-html-block-start-only-on-block-tags", new MutableDataSet().set(Parser.HTML_BLOCK_START_ONLY_ON_BLOCK_TAGS, false));
optionsMap.put("setext-marker-length", new MutableDataSet().set(Parser.HEADING_SETEXT_MARKER_LENGTH, 3));
optionsMap.put("src-pos-lines", new MutableDataSet().set(HtmlRenderer.SOURCE_POSITION_PARAGRAPH_LINES, true).set(Parser.CODE_SOFT_LINE_BREAKS, true));
optionsMap.put("src-pos-lines-splice", new MutableDataSet().set(HtmlRenderer.SOURCE_POSITION_PARAGRAPH_LINES, true).set(Parser.CODE_SOFT_LINE_BREAKS, true).set(HtmlRenderer.INLINE_CODE_SPLICE_CLASS, "line-spliced"));
Expand All @@ -121,6 +122,7 @@ public abstract class CoreRendererSpecTest extends RendererSpecTest {
optionsMap.put("spec-027", new MutableDataSet().set(Parser.STRONG_WRAPS_EMPHASIS, true));
optionsMap.put("custom-list-marker", new MutableDataSet().set(Parser.LISTS_ITEM_PREFIX_CHARS, "*/"));
optionsMap.put("no-p-tags", new MutableDataSet().set(HtmlRenderer.NO_P_TAGS_USE_BR, true));
optionsMap.put("allow-name-space", new MutableDataSet().set(Parser.HTML_ALLOW_NAME_SPACE, true));
optionsMap.put("list-markdown-navigator", new MutableDataSet()
.set(Parser.LISTS_AUTO_LOOSE, false)
.set(Parser.LISTS_AUTO_LOOSE, false)
Expand Down
151 changes: 151 additions & 0 deletions flexmark-core-test/src/test/resources/core_extra_ast_spec2.md
Original file line number Diff line number Diff line change
Expand Up @@ -634,3 +634,154 @@ Document[0, 114]
````````````````````````````````


## HTML Allow Name Space

```````````````````````````````` example(HTML Allow Name Space: 1) options(allow-name-space)
<ns:elem>
</ns:elem>
.
<ns:elem>
</ns:elem>
.
Document[0, 22]
HtmlBlock[0, 21]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 2) options(deep-html-parsing, allow-name-space)
<ns:strong>
</ns:strong>
.
<p><a href="ns:strong">ns:strong</a>
&lt;/ns:strong&gt;</p>
.
Document[0, 26]
Paragraph[0, 25] isTrailingBlankLine
AutoLink[0, 11] open:[0, 1, "<"] text:[1, 10, "ns:strong"] pageRef:[1, 10, "ns:strong"] close:[10, 11, ">"]
SoftLineBreak[11, 12]
Text[12, 24] chars:[12, 24, "</ns: … rong>"]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 3) options(deep-html-parsing, allow-name-space, no-html-block-start-only-on-block-tags)
<ns:strong>
</ns:strong>
.
<ns:strong>
</ns:strong>
.
Document[0, 26]
HtmlBlock[0, 25]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 4) options(deep-html-parsing)
<ns:table>
</ns:table>
.
<ns:table>
</ns:table>
.
Document[0, 24]
HtmlBlock[0, 23]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 5) options(deep-html-parsing, allow-name-space)
<ns:table>
</ns:table>
.
<ns:table>
</ns:table>
.
Document[0, 24]
HtmlBlock[0, 23]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 6) options(deep-html-parsing, allow-name-space, no-html-block-start-only-on-block-tags)
<ns:table>
</ns:table>
.
<ns:table>
</ns:table>
.
Document[0, 24]
HtmlBlock[0, 23]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 7) options(allow-name-space)
<ns:table>
</ns:table>
.
<ns:table>
</ns:table>
.
Document[0, 24]
HtmlBlock[0, 23]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 8) options(allow-name-space)
<ns:table>
</ns:table>
.
<ns:table>
</ns:table>
.
Document[0, 24]
HtmlBlock[0, 23]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 9) options(allow-name-space, html-block-start-only-on-block-tags)
<ns:table>
</ns:table>
.
<ns:table>
</ns:table>
.
Document[0, 24]
HtmlBlock[0, 23]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 10) options(allow-name-space, html-block-start-only-on-block-tags)
<ns:strong>
</ns:strong>
.
<p><a href="ns:strong">ns:strong</a>
&lt;/ns:strong&gt;</p>
.
Document[0, 26]
Paragraph[0, 25] isTrailingBlankLine
AutoLink[0, 11] open:[0, 1, "<"] text:[1, 10, "ns:strong"] pageRef:[1, 10, "ns:strong"] close:[10, 11, ">"]
SoftLineBreak[11, 12]
Text[12, 24] chars:[12, 24, "</ns: … rong>"]
````````````````````````````````


```````````````````````````````` example(HTML Allow Name Space: 11) options(allow-name-space, no-html-block-start-only-on-block-tags)
<ns:strong>
</ns:strong>
.
<ns:strong>
</ns:strong>
.
Document[0, 26]
HtmlBlock[0, 25]
````````````````````````````````


4 changes: 2 additions & 2 deletions flexmark-docx-converter/flexmark-docx-converter.iml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
<orderEntry type="module" module-name="flexmark-ext-toc" />
<orderEntry type="module" module-name="flexmark-ext-wikilink" />
<orderEntry type="module" module-name="flexmark-ext-autolink" scope="TEST" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="flexmark-ext-gitlab" />
<orderEntry type="module" module-name="flexmark-ext-macros" />
Expand All @@ -61,4 +61,4 @@
<orderEntry type="library" name="slf4j.log4j.over" level="project" />
<orderEntry type="library" name="slf4j-api-1.7.26" level="project" />
</component>
</module>
</module>
2 changes: 1 addition & 1 deletion flexmark-ext-abbreviation/flexmark-ext-abbreviation.iml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<orderEntry type="module" module-name="flexmark-util-misc" />
<orderEntry type="module" module-name="flexmark-util-sequence" />
<orderEntry type="module" module-name="flexmark-util-visitor" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
<orderEntry type="module" module-name="flexmark-ext-typographic" scope="TEST" />
Expand Down
2 changes: 1 addition & 1 deletion flexmark-ext-admonition/flexmark-ext-admonition.iml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<orderEntry type="module" module-name="flexmark-util-misc" />
<orderEntry type="module" module-name="flexmark-util-sequence" />
<orderEntry type="module" module-name="flexmark-util-visitor" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="flexmark-test-util" scope="TEST" />
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
Expand Down
2 changes: 1 addition & 1 deletion flexmark-ext-anchorlink/flexmark-ext-anchorlink.iml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<orderEntry type="module" module-name="flexmark-util-misc" />
<orderEntry type="module" module-name="flexmark-util-sequence" />
<orderEntry type="module" module-name="flexmark-util-visitor" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
<orderEntry type="library" name="org.jetbrains:annotations" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion flexmark-ext-aside/flexmark-ext-aside.iml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<orderEntry type="module" module-name="flexmark" />
<orderEntry type="module" module-name="flexmark-test-util" scope="TEST" />
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
<orderEntry type="library" name="org.jetbrains:annotations" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion flexmark-ext-attributes/flexmark-ext-attributes.iml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
<orderEntry type="module" module-name="flexmark-ext-anchorlink" scope="TEST" />
<orderEntry type="module" module-name="flexmark-ext-toc" scope="TEST" />
<orderEntry type="module" module-name="flexmark-ext-emoji" scope="TEST" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="flexmark-ext-definition" scope="TEST" />
<orderEntry type="module" module-name="flexmark-ext-tables" scope="TEST" />
Expand Down
2 changes: 1 addition & 1 deletion flexmark-ext-autolink/flexmark-ext-autolink.iml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<orderEntry type="module" module-name="flexmark-util-sequence" />
<orderEntry type="module" module-name="flexmark-util-visitor" />
<orderEntry type="library" name="Maven: org.nibor.autolink:autolink:0.6.0" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="flexmark-ext-typographic" scope="TEST" />
<orderEntry type="library" name="org.jetbrains:annotations" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion flexmark-ext-definition/flexmark-ext-definition.iml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
<orderEntry type="module" module-name="flexmark" />
<orderEntry type="module" module-name="flexmark-test-util" scope="TEST" />
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
<orderEntry type="library" name="org.jetbrains:annotations" level="project" />
Expand Down
2 changes: 1 addition & 1 deletion flexmark-ext-emoji/flexmark-ext-emoji.iml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<orderEntry type="module" module-name="flexmark-util-sequence" />
<orderEntry type="module" module-name="flexmark-util-visitor" />
<orderEntry type="module" module-name="flexmark-jira-converter" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
<orderEntry type="library" name="org.jetbrains:annotations" level="project" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
<orderEntry type="module" module-name="flexmark-ext-attributes" />
<orderEntry type="module" module-name="flexmark-ext-tables" scope="TEST" />
<orderEntry type="module" module-name="flexmark-core-test" scope="TEST" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.12" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:4.13" level="project" />
<orderEntry type="library" scope="TEST" name="Maven: org.hamcrest:hamcrest-core:1.3" level="project" />
<orderEntry type="library" name="org.jetbrains:annotations" level="project" />
</component>
Expand Down
Loading

0 comments on commit 5d8ccbc

Please sign in to comment.