Skip to content
This repository has been archived by the owner on Nov 8, 2022. It is now read-only.

#633: Error compiling file `url.replace is not a function #676

Merged
merged 8 commits into from
Jun 5, 2020
Merged

#633: Error compiling file `url.replace is not a function #676

merged 8 commits into from
Jun 5, 2020

Conversation

hkollmann
Copy link
Member

  • markdown error as warning
  • add more tests

Copy link
Member

@johnspackman johnspackman left a comment

Choose a reason for hiding this comment

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

IMHO we should fix the markdown processor, or switch to a markdown processor that is more robust and/or gives more sensible messages

@@ -99,7 +99,7 @@ qx.Class.define("qx.tool.compiler.jsdoc.Parser", {
try {
cmd.body = converter.makeHtml(cmd.body);
} catch (e) {
qx.tool.compiler.Console.error(`Markdown conversion error: "${e.message}" found in \n${cmd.body.trim()}`);
qx.tool.compiler.Console.warn(`Markdown conversion: "${e.message}" found in \n${cmd.body.trim()}`);
Copy link
Member

Choose a reason for hiding this comment

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

Isn't the exception being raised a bug in the "showdown" module? EG what is wrong with having a comment like

    /**
     * --------------------------------------------------------------------------
     * [Constructor]
     * --------------------------------------------------------------------------
     */
    construct: function()

Even if we decided to enforce strict rules on comment formatting, it should not say something inexplicable just url.replace is not a function.

Copy link
Contributor

@cboulanger cboulanger May 6, 2020

Choose a reason for hiding this comment

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

Maybe the simplest thing would be making the warning more explicative:

Markdown conversion problem: Error "${e.message}" was thrown parsing "${cmd.body.trim()}". 
Please review your doc comments for compatibility with Markdown syntax.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think there should be anything in a comment that causes it to barf. If it's understandable as markdown, then treat it as such. If not, don't tell the user how to write a comment. (A warning that can be turned off via command-line option or @ignore or whatever is ok; just not an error.)

- add verbose property to console so that the verbose flag can be used elsewhere
@hkollmann
Copy link
Member Author

Implemented both suggestions from @cboulanger and @derrell

@level420
Copy link
Member

level420 commented May 7, 2020

BTW: this url.replace is not a function seems to be a bug in node module showdown: showdownjs/showdown#548
Created in 2018, labeled as a bug, but still unresolved :-(
So we are fighting agains a bug in another module, which is bad.

@level420
Copy link
Member

level420 commented May 7, 2020

and what I've understood from that bug is, that every markdown named like a javascript reserved word could cause the exception, like e.g. constructor

Copy link
Member

@johnspackman johnspackman left a comment

Choose a reason for hiding this comment

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

i dont think this is the right approach, we should ditch showdown altogether - if this is a two year old bug, it doesnt sound like it's maintained very well.

Even if the markdown is not valid, the warning "url.replace..." is meaningless and very misleading - it also suggests that one typo anywhere in a long comment could break the entire markdown process for that comment.

@level420
Copy link
Member

level420 commented May 7, 2020

@johnspackman as I've understood it will only break for links, but its bad anyway

@hkollmann
Copy link
Member Author

Do you know an alternative to showdown?

@johnspackman
Copy link
Member

Not personally but there are several out there.

Github use https://github.com/github/cmark-gfm, but that's a C library so there is this nodejs wrapper: https://github.com/killagu/node-cmark

For a pure JS approach there is https://github.com/markdown-it/markdown-it "Markdown parser done right. Fast and easy to extend."

Or https://marked.js.org/

@hkollmann hkollmann added the do not merge do not merge the PR yet! label May 11, 2020
@hkollmann hkollmann marked this pull request as draft May 18, 2020 07:34
@hkollmann hkollmann closed this May 22, 2020
@hkollmann hkollmann deleted the fix_633_2 branch May 22, 2020 15:47
@cboulanger
Copy link
Contributor

@hkollmann Can you document why did you closed this? Was the bug resolved with another PR?

@hkollmann hkollmann restored the fix_633_2 branch May 22, 2020 16:22
@hkollmann
Copy link
Member Author

was an accident

@hkollmann hkollmann reopened this May 22, 2020
@cboulanger
Copy link
Contributor

@johnspackman You are right, but can we accept this workaround now and deal with switching the markdown parser later, since this would push the release date again? The current system is working except this bug. I'll create a separate issue for v7 so we don't forget. Ok?

@hkollmann hkollmann removed the do not merge do not merge the PR yet! label Jun 2, 2020
@hkollmann hkollmann marked this pull request as ready for review June 2, 2020 08:05
@johnspackman johnspackman merged commit 3e45664 into qooxdoo:master Jun 5, 2020
@johnspackman
Copy link
Member

Thank you @hkollmann

@hkollmann hkollmann deleted the fix_633_2 branch August 5, 2020 06:59
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants