Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

For emphasis, using asterisks to bold and italicize the middle of a word doesn't work. #557

Open
2 of 7 tasks
arjun2 opened this issue Feb 28, 2023 · 5 comments · May be fixed by #580
Open
2 of 7 tasks

For emphasis, using asterisks to bold and italicize the middle of a word doesn't work. #557

arjun2 opened this issue Feb 28, 2023 · 5 comments · May be fixed by #580

Comments

@arjun2
Copy link

arjun2 commented Feb 28, 2023

For emphasis, using asterisks to bold and italicize the middle of a word doesn't work.

  • Parser
  • HtmlRenderer
  • Formatter
  • FlexmarkHtmlParser
  • DocxRenderer
  • PdfConverterExtension
  • extension(s)

Example:
Input: "This is really***very***important text."

Expected: <p>This is really<em><strong>very</strong></em>important text.</p>

Actual: <p>This is really***very***important text.</p>

@arjun2
Copy link
Author

arjun2 commented Feb 28, 2023

Can I please get some help on this ? I was looking at options on Parser but don't see any thing that can help.
Note that it works with https://github.com/commonmark/commonmark-java

@david-waltermire
Copy link

david-waltermire commented Jun 10, 2023

@arjun2 I am seeing the same. This is example 415 from the CommonMark specification.

A parser creates the following AST:

Document[0, 16]
  Paragraph[0, 16]
    Text[0, 15] chars:[0, 15, "foo** … **baz"]

Notice the missing StrongEmphasis and Emphasis nodes.

This seems like a bug in Flexmark.

@david-waltermire
Copy link

david-waltermire commented Jun 10, 2023

Tracing this, I believe the problem relates to the code at:

https://github.com/vsch/flexmark-java/blame/cc3a2f59ba6e532833f4805f8134b4dc966ff837/flexmark/src/main/java/com/vladsch/flexmark/parser/internal/InlineParserImpl.java#L1418

It looks like the loop here is rewinding the stack to find the outer most opener and closer. Then processing the result.

This code is a bit complex, so I am not fully sure what is happening, but this seems to result in the delimiters getting ignored.

@david-waltermire
Copy link

@vsch Is there a possibility of prioritizing a fix? I am not sure I am able to fully debug this to create a PR or I would.

david-waltermire added a commit to david-waltermire/flexmark-java that referenced this issue Jun 23, 2023
@david-waltermire david-waltermire linked a pull request Jun 23, 2023 that will close this issue
david-waltermire added a commit to david-waltermire/metaschema-java-old that referenced this issue Jun 23, 2023
david-waltermire added a commit to david-waltermire/metaschema-java-old that referenced this issue Jun 23, 2023
Cleaned up markup handling code and fixed a bunch of bugs. Moved parsing from the adapters to the data classes.
Consolidated Flexmark extension classes for p tag and quote handling.
Fixed newline handling in XML markup generation.
Fixed bug related to vsch/flexmark-java#557.
Fixed table indentation.
@david-waltermire
Copy link

@vsch Is there a possibility of prioritizing a fix? I am not sure I am able to fully debug this to create a PR or I would.

I was able to create a PR after all. Let me know if this works or needs adjustments.

david-waltermire added a commit to david-waltermire/metaschema-java-old that referenced this issue Jun 26, 2023
Cleaned up markup handling code and fixed a bunch of bugs. Moved parsing from the adapters to the data classes.
Consolidated Flexmark extension classes for p tag and quote handling.
Fixed newline handling in XML markup generation.
Fixed bug related to vsch/flexmark-java#557.
Fixed table indentation.
david-waltermire added a commit to usnistgov/metaschema-java that referenced this issue Jun 26, 2023
* Redesigned XML markup handling to support a wider set of HTML tags.
* Added support for `<link title="">` and table alignment.
* Added better error message for cases where a LinkRef is found in error.
* Completed work on a CommonMark-based markdown unit test suite.
   - Cleaned up markup handling code and fixed a bunch of bugs. Moved parsing from the adapters to the data classes.
   - Consolidated Flexmark extension classes for p tag and quote handling.
   - Fixed newline handling in XML markup generation.
   - Fixed bug related to vsch/flexmark-java#557.
   - Fixed table indentation.
* Fixed a few markdown handling issues.
* Fixed a bunch of compile, PMD, and spotbugs warnings.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants