mikaelbr / marked-terminal

A Renderer for the marked project. Allowing you to render Markdown to print to your Terminal
MIT License
425 stars 57 forks source link

Markdown Link is Incompatible with Blessed #57

Open tonywei92 opened 5 years ago

tonywei92 commented 5 years ago

markdown

- **[pica](https://nodeca.github.io/pica/demo/)** - high quality and fast image
  resize in browser.

output:

]8;;https://nodeca.github.io/pica/demo/pica]8;; - high quality and fast image

expected output:

code:

const blessed = require("blessed");
const marked = require("marked");
const TerminalRenderer = require("marked-terminal");

marked.setOptions({
      // Define custom renderer
      renderer: new TerminalRenderer()
    });

var screen = blessed.screen({
      smartCSR: true
    });

const markdown = blessed.box({
      top: 0,
      left: 0,
      width: "100%",
      height: "95%",
      border: {
        type: "line"
      },
      style: {
        fg: "white",
        bg: "black",
        border: {
          // fg: "#f0f0f0"
        },
        hover: {
          // bg: "green"
        }
      }
    });

markdown.setContent(
      marked(`- **[pica](https://nodeca.github.io/pica/demo/)** - high quality and fast image
    resize in browser.`)
    );

screen.append(markdown);

screen.render();

    screen.key(["escape", "q", "C-c"], function(ch, key) {
      return process.exit(0);
    });

please help

UPDATE, found the issue:

this is parsed markdown file from 1.5.0, with EXPECTED OUTPUT


    * pica (https://nodeca.github.io/pica/demo/) - high quality and fast image
     resize in browser.

and this is from 3.3.0 with UNEXPECTED OUTPUT:

    * ]8;;https://nodeca.github.io/pica/demo/pica]8;; - high quality and fast image
        resize in browser.
isamrish commented 5 years ago

@tonywei92 -- I like to do it, please assign me.

mikaelbr commented 5 years ago

Great, @IsAmrish. I've assigned you now. Please let me know if there's questions you have. I would start by just setting up locally and investigating/testing out the code. Run the examples and the test and see how it works.

isamrish commented 5 years ago

@mikaelbr @tonywei92 -- I tried above code and I got this output. I am using PowerShell on windows

blessed-example

You can see my code here https://github.com/IsAmrish/blessed-example

please let me know, how can I reproduce the above error?

ajboni commented 4 years ago

I can reproduce the error doing the same steps @tonywei92 described above.