Skip to content

Use JSoup to convert HTML to XHTML after parsing with Flexmark - #1001

Merged
kwin merged 1 commit into
apache:masterfrom
kwin:bugfix/accept-html-within-markdown
Oct 7, 2025
Merged

kwin merged 1 commit into
apache:masterfrom
kwin:bugfix/accept-html-within-markdown

Conversation

@kwin

@kwin kwin commented Sep 12, 2025

Copy link
Copy Markdown
Member

That way valid XHTML is passed to the XHTML parser. This is crucial as markdown may contain elements which are no properly closed (for example inline html5 with unclosed

tags)

This closes #999

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Your pull request should address just one issue, without pulling in other changes.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body.
    Note that commits might be squashed by a maintainer on merge.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied.
    This may not always be possible but is a best-practice.
  • Run mvn verify to make sure basic checks pass.
    A more thorough check will be performed on your pull request automatically.
  • You have run the integration tests successfully (mvn -Prun-its verify).

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

That way valid XHTML is passed to the XHTML parser.
This is crucial as markdown may contain elements which are no properly
closed (for example inline html5 with unclosed <p> tags)

This closes apache#999
@michael-o

Copy link
Copy Markdown
Member

There is no way to configure flexmark?

The is yet another problem with JSoup. The the library is great, the license conditions are problematic to distribute. There was a report about this in Wagon and at the end I have removed JSoup because of this. Please look up the issue in JIRA.

@kwin

kwin commented Sep 12, 2025 •

Copy link
Copy Markdown
Member Author

JSoup is MIT which is according to https://www.apache.org/legal/resolved.html#category-a Category A and fully fine with ASF policies.

@michael-o

Copy link
Copy Markdown
Member

JSoup is MIT which is according to https://www.apache.org/legal/resolved.html#category-a Category A and fully fine with ASF policies.

No: https://issues.apache.org/jira/browse/WAGON-619

@cstamas

cstamas commented Sep 12, 2025

Copy link
Copy Markdown
Member

But are we shading it in this case? I don't get what the problem is?

@michael-o

Copy link
Copy Markdown
Member

But are we shading it in this case? I don't get what the problem is?

I don't that shading is the problem, but using the binary library.

@cstamas

cstamas commented Sep 12, 2025

Copy link
Copy Markdown
Member

Again, why? Can you explain in one sentence?

So you say depending on MIT licensed JAR is to be avoided?

@cstamas

cstamas commented Sep 12, 2025

Copy link
Copy Markdown
Member

As I see on ML the sentence that causes the problem when jsoup is included in build result is "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.", but here, a plain maven dependency is declared, and is nothing like that (shading/copying). JSoup will not be present in the artifacts (source or binaries) we will once vote upon either.

Again, no idea what are you implying.

@michael-o

Copy link
Copy Markdown
Member

As I see on ML the sentence that causes the problem when jsoup is included in build result is "The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.", but here, a plain maven dependency is declared, and is nothing like that (shading/copying). JSoup will not be present in the artifacts (source or binaries) we will once vote upon either.

Again, no idea what are you implying.

IANAL. Just wanted to make you guys aware of previous discussion.

@cstamas

cstamas commented Sep 12, 2025

Copy link
Copy Markdown
Member

IANAL either, but there (in "wagon case") it was shading the obvious problem: you "included" (copied) JSoup software into your software and you put it on ASF vote. Basically JSoup became part of the vote.

@michael-o
michael-o removed their request for review September 26, 2025 11:05
@kwin
kwin merged commit fa5358f into apache:master Oct 7, 2025
@kwin
kwin deleted the bugfix/accept-html-within-markdown branch October 7, 2025 15:53
@github-actions github-actions Bot added this to the 2.1.0 milestone Oct 7, 2025
@github-actions

github-actions Bot commented Oct 7, 2025

Copy link
Copy Markdown

@kwin Please assign appropriate label to PR according to the type of change.

@kwin kwin added the bug Something isn't working label Oct 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MarkdownParser: Doxia claims "unclosed" <p> conflicts with </td>

4 participants