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

8354320: Changes to jpackage.md cause pandoc warning #24585

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

alexeysemenyukoracle
Copy link
Member

@alexeysemenyukoracle alexeysemenyukoracle commented Apr 10, 2025

Escape the dollar sign.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Issue

  • JDK-8354320: Changes to jpackage.md cause pandoc warning (Bug - P3)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/24585/head:pull/24585
$ git checkout pull/24585

Update a local copy of the PR:
$ git checkout pull/24585
$ git pull https://git.openjdk.org/jdk.git pull/24585/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 24585

View PR using the GUI difftool:
$ git pr show -t 24585

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/24585.diff

Using Webrev

Link to Webrev Comment

@alexeysemenyukoracle alexeysemenyukoracle marked this pull request as ready for review April 10, 2025 21:50
@alexeysemenyukoracle
Copy link
Member Author

@sashamatveev PTAL

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 10, 2025

👋 Welcome back asemenyuk! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk
Copy link

openjdk bot commented Apr 10, 2025

@alexeysemenyukoracle This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8354320: Changes to jpackage.md cause pandoc warning

Reviewed-by: almatvee, ihse, alanb

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 27 new commits pushed to the master branch:

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 10, 2025
@openjdk
Copy link

openjdk bot commented Apr 10, 2025

@alexeysemenyukoracle The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@alexeysemenyukoracle
Copy link
Member Author

@magicus PTAL

@mlbridge
Copy link

mlbridge bot commented Apr 10, 2025

Webrevs

Copy link
Contributor

@AlanBateman AlanBateman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for jumping on this, just to fix the warning until it is looked at more closely.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 11, 2025
@magicus
Copy link
Member

magicus commented Apr 11, 2025

I'm not entirely sure this is a good solution. Yes, it makes pandoc happy and removes the warning, but this is using a pandoc extension and not standard markdown. A standard markdown renderer will show this as the literal \$, and not just a $ which is intended.

I will repeat my suggestion to put the special characters inside backticks. Not only will it prevent pandoc from trying to do any expansion, it will also follow a general practice of formatting code where literals the user should type is in monotype. So I think it would kill two birds with one stone.

@alexeysemenyukoracle
Copy link
Member Author

"`${`"

emits a slightly different warning:

[WARNING] Could not convert TeX math ) and the first following non-alphanumeric character. Alternatively, it can be enclosed between "`, rendering as TeX:
  e enclosed between "`
                     ^
  unexpected '"' 

Similar with

`${`

the warning is:

[WARNING] Could not convert TeX math ) and the first following non-alphanumeric character. Alternatively, it can be enclosed between "`, rendering as TeX:
  e enclosed between "`
                     ^
  unexpected '"' 

It seems like it can't handle the dollar character unless it is escaped with the backslash.

Even though raw jpackage.md renders the backslash, man and HTML outputs look correct.

I'm not an expert in pandoc or markdown. If you have any other ideas about how to fix it, I'll be happy to try them out.

@magicus
Copy link
Member

magicus commented Apr 11, 2025

Oh, that's too bad. :( Weird that pandoc tries to modify stuff inside ``. I think the better solution then is to pass -tex_math_dollars to pandoc to stop it from trying to parse the dollar sign. We should not be using the TeX math extension anyway. I'll whip up a build patch, one sec...

@alexeysemenyukoracle
Copy link
Member Author

Meanwhile, I fixed a case of missing escape backslash in the following paragraph. I verified that it is rendered properly in raw markdown and in pandoc output.

@openjdk openjdk bot removed the ready Pull request is ready to be integrated label Apr 11, 2025
@magicus
Copy link
Member

magicus commented Apr 11, 2025

Try this patch:

diff --git a/make/autoconf/basic_tools.m4 b/make/autoconf/basic_tools.m4
index eac14207b1d..516529116c3 100644
--- a/make/autoconf/basic_tools.m4
+++ b/make/autoconf/basic_tools.m4
@@ -468,7 +468,14 @@ AC_DEFUN_ONCE([BASIC_SETUP_PANDOC],
     AC_MSG_CHECKING([if the pandoc smart extension needs to be disabled for markdown])
     if $PANDOC --list-extensions | $GREP -q '+smart'; then
       AC_MSG_RESULT([yes])
-      PANDOC_MARKDOWN_FLAG="markdown-smart"
+      PANDOC_MARKDOWN_FLAG="$PANDOC_MARKDOWN_FLAG-smart"
+    else
+      AC_MSG_RESULT([no])
+    fi
+    AC_MSG_CHECKING([if the pandoc tex_math_dollars extension needs to be disabled for markdown])
+    if $PANDOC --list-extensions | $GREP -q '+tex_math_dollars'; then
+      AC_MSG_RESULT([yes])
+      PANDOC_MARKDOWN_FLAG="$PANDOC_MARKDOWN_FLAG-tex_math_dollars"
     else
       AC_MSG_RESULT([no])
     fi

(and remove the \ in front of $).

@alexeysemenyukoracle
Copy link
Member Author

Ironically, I came up with the same patch a few minutes ago. Even the change to PANDOC_MARKDOWN_FLAG="$PANDOC_MARKDOWN_FLAG-smart" is the same.

@alexeysemenyukoracle
Copy link
Member Author

With the latest fix, the warning is gone, the raw markdown looks as expected when viewed online, and the man output looks correct.

Copy link
Member

@sashamatveev sashamatveev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Apr 11, 2025
Copy link
Member

@magicus magicus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe wait for someone else to review the build change too...

@alexeysemenyukoracle
Copy link
Member Author

@erikj79 PTAL

@AlanBateman
Copy link
Contributor

Thanks for getting this to the right place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org ready Pull request is ready to be integrated rfr Pull request is ready for review
Development

Successfully merging this pull request may close these issues.

4 participants