codetour icon indicating copy to clipboard operation
codetour copied to clipboard

Added markdown parser (unified + remark) in player to replace regex replaces

Open ivancea opened this issue 4 years ago • 6 comments

As commented in #150

  • Added unified and remark-xxx libraries to parse and re-convert to markdown after modifications
  • Added mdast-builder for a functional markdown AST creation

ivancea avatar Mar 29 '21 18:03 ivancea

CLA assistant check
All CLA requirements met.

ghost avatar Mar 29 '21 18:03 ghost

I'v changed some configurations and a dependency version:

  • In package.json: vscode from ^1.1.25 to ^1.1.37. The old version is giving me an erorr in its postinstall script (a 404 in a request it makes)
  • In tsconfig.json: Added the esModuleInterop option to be able to use the import ... from ... syntax instead of import * as ... from ... with the new dependencies (also, to avoid using the require(...) syntax

If you think any of those changes may be problematic, I'll undo them (if that's the case, please tell me which import/require syntax would you use)

ivancea avatar Mar 29 '21 19:03 ivancea

For now only the code fence part was replaced. If you think this approach is acceptable, I'll change the other regexes.

In the other hand, to replace the other regexes, I would like to know if there is any documentation about them. I understand the SHELL_SCRIPT one, but I'm not sure about the use case of the COMMAND and TOUR_REFERENCE ones

ivancea avatar Mar 29 '21 19:03 ivancea

I just tried this branch, and it seems like step references are broken. Are you seeing that behavior?

lostintangent avatar Apr 03 '21 20:04 lostintangent

I just tried this branch, and it seems like step references are broken. Are you seeing that behavior?

Fixed. The AST-to-string was escaping literal characters with backslashes (square brackets not being part of a link), so the regex wasn't working. I changed it to first apply the regex and then the AST. Anyway, I wouldn't merge this until all the replace-like modifications are changed to the parser

ivancea avatar Apr 03 '21 21:04 ivancea

Fff

zubair1024 avatar Aug 31 '21 07:08 zubair1024