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

Convert to Asciidoc does nothing (visible) #1206

Open
lefou opened this issue Oct 24, 2022 · 2 comments
Open

Convert to Asciidoc does nothing (visible) #1206

lefou opened this issue Oct 24, 2022 · 2 comments
Labels

Comments

@lefou
Copy link
Member

lefou commented Oct 24, 2022

Observed vs. expected behavior

After selecting a rather large readme.md file and clicking on "Convert to AsciiDoc", nothing happens, not conversion, not error message, no noticable CPU work.

I expected that the file gets converted (as it does in other cases).

Steps to reproduce

Environment

Plugin Version: 0.37.54
IntelliJ IDEA Version: 2022.2.3 (Community Edition) and 2021.2.4 (Ultimate Edition)
Up-to-date Gentoo Linux on AMD64 with Kernel 5.15.59 on X11

@lefou lefou added the bug label Oct 24, 2022
@ahus1
Copy link
Contributor

ahus1 commented Oct 24, 2022

Sorry to see this happend in that project, and thank for raising the issue.

I can reproduce the problem locally; instead of the conversion the IDE logs an error (there should be a small red blinking exclamation mark at the lower right corner of your IDE).

There seems that the following regex is causing some problems:

https://github.com/bodiam/markdown-to-asciidoc/blob/79096394029812b234c4546b126cda6041d2c6ac/src/main/java/nl/jworks/markdown_to_asciidoc/Converter.java#L44-L46

        if (markdown.contains("```")) {
            markdown = markdown.replaceAll("(?m)(?<!\n\n)(\\s*)```(\\w*\n)((?:\\1[^\n]*\n)+)\\1```", "\n$1```$2$3$1```");
        }

With the example you provided above, this leads to the following exception below. I won't have the time to dig into this in more details over the next days, still I hope to be able to analyze this soon.

As a workaround, please consider converting it with PanDoc.

java.lang.StackOverflowError
	at java.base/java.lang.Character.codePointAt(Character.java:8910)
	at java.base/java.util.regex.Pattern$CharPropertyGreedy.match(Pattern.java:4273)
	at java.base/java.util.regex.Pattern$BackRef.match(Pattern.java:5029)
...
	at java.base/java.util.regex.Pattern$GroupHead.match(Pattern.java:4789)
	at java.base/java.util.regex.Pattern$NotBehind.match(Pattern.java:5295)
	at java.base/java.util.regex.Pattern$StartS.match(Pattern.java:3641)
	at java.base/java.util.regex.Matcher.search(Matcher.java:1728)
	at java.base/java.util.regex.Matcher.find(Matcher.java:745)
	at java.base/java.util.regex.Matcher.replaceAll(Matcher.java:1177)
	at java.base/java.lang.String.replaceAll(String.java:2942)
	at nl.jworks.markdown_to_asciidoc.Converter.convertMarkdownToAsciiDoc(Converter.java:45)
	at org.asciidoc.intellij.actions.ConvertToAsciiDocAction$1$1.run(ConvertToAsciiDocAction.java:80)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:219)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:174)
	at com.intellij.openapi.command.impl.CoreCommandProcessor.executeCommand(CoreCommandProcessor.java:164)
	at org.asciidoc.intellij.actions.ConvertToAsciiDocAction$1.run(ConvertToAsciiDocAction.java:68)
	at com.intellij.openapi.application.impl.ApplicationImpl.runWriteAction(ApplicationImpl.java:955)
	at org.asciidoc.intellij.actions.ConvertToAsciiDocAction.actionPerformed(ConvertToAsciiDocAction.java:65)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.doPerformActionOrShowPopup(ActionUtil.java:321)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.lambda$performActionDumbAwareWithCallbacks$4(ActionUtil.java:300)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performDumbAwareWithCallbacks(ActionUtil.java:344)
	at com.intellij.openapi.actionSystem.ex.ActionUtil.performActionDumbAwareWithCallbacks(ActionUtil.java:300)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$performAction$5(ActionMenuItem.java:296)
	at com.intellij.openapi.wm.impl.FocusManagerImpl.runOnOwnContext(FocusManagerImpl.java:226)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.performAction(ActionMenuItem.java:289)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$new$0(ActionMenuItem.java:64)
	at java.desktop/javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1972)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.lambda$fireActionPerformed$4(ActionMenuItem.java:111)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:105)
	at com.intellij.openapi.application.TransactionGuardImpl.performUserActivity(TransactionGuardImpl.java:94)
	at com.intellij.openapi.actionSystem.impl.ActionMenuItem.fireActionPerformed(ActionMenuItem.java:111)
	at com.intellij.ui.plaf.beg.BegMenuItemUI.doClick(BegMenuItemUI.java:526)
	at com.intellij.ui.plaf.beg.BegMenuItemUI$MyMouseInputHandler.mouseReleased(BegMenuItemUI.java:558)
	at java.desktop/java.awt.Component.processMouseEvent(Component.java:6648)
	at java.desktop/javax.swing.JComponent.processMouseEvent(JComponent.java:3392)
	at java.desktop/java.awt.Component.processEvent(Component.java:6413)
	at java.desktop/java.awt.Container.processEvent(Container.java:2266)
	at java.desktop/java.awt.Component.dispatchEventImpl(Component.java:5022)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2324)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4948)
	at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Container.java:4575)
	at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Container.java:4516)
	at java.desktop/java.awt.Container.dispatchEventImpl(Container.java:2310)
	at java.desktop/java.awt.Window.dispatchEventImpl(Window.java:2802)
	at java.desktop/java.awt.Component.dispatchEvent(Component.java:4854)
	at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:781)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:730)
	at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:724)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:97)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:754)
	at java.desktop/java.awt.EventQueue$5.run(EventQueue.java:752)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
	at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
	at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:751)
	at com.intellij.ide.IdeEventQueue.defaultDispatchEvent(IdeEventQueue.java:909)
	at com.intellij.ide.IdeEventQueue.dispatchMouseEvent(IdeEventQueue.java:831)
	at com.intellij.ide.IdeEventQueue._dispatchEvent(IdeEventQueue.java:753)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$5(IdeEventQueue.java:437)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computePrioritized(CoreProgressManager.java:774)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$6(IdeEventQueue.java:436)
	at com.intellij.openapi.application.TransactionGuardImpl.performActivity(TransactionGuardImpl.java:113)
	at com.intellij.ide.IdeEventQueue.performActivity(IdeEventQueue.java:615)
	at com.intellij.ide.IdeEventQueue.lambda$dispatchEvent$7(IdeEventQueue.java:434)
	at com.intellij.openapi.application.impl.ApplicationImpl.runIntendedWriteActionOnCurrentThread(ApplicationImpl.java:813)
	at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:480)
	at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:207)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:128)
	at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:117)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:113)
	at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:105)
	at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:92)

@lefou
Copy link
Member Author

lefou commented Oct 25, 2022

Thanks for your fast response. In the meantime, I converted the file with kramdown-asciidoc, which works reasonable well. I had to edit cross-references though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants