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

Syntax highlighting does not work when another mardown library is imported #3

Open
pathikrit opened this issue Apr 26, 2023 · 0 comments

Comments

@pathikrit
Copy link

I have following code:

import cliMd from 'cli-markdown'            // "^3.0.3"
import mdjs from '@moox/markdown-to-json'   // "^1.0.0"

const TEST_CONTENT = "```python\na=7\nb=5\n```"
console.log(cliMd(TEST_CONTENT)) 
const tree = mdjs.markdownAsJsTree(TEST_CONTENT)

This works:
Screenshot 2023-04-26 at 1 16 07 PM

The actual string sent to the terminal is this:

  �[30m�[1m1�[22m�[39m a=�[32m7�[39m
  �[30m�[1m2�[22m�[39m b=�[32m5�[39m

But if I switch the order of lines, it prints nothing:

const TEST_CONTENT = "```python\na=7\nb=5\n```"
const tree = mdjs.markdownAsJsTree(TEST_CONTENT)
console.log(cliMd(TEST_CONTENT))

Screenshot 2023-04-26 at 1 16 34 PM

The string sent to the terminal is this:

[30m�[1m1�[22m�[39m

Why? Why does it matter if I executed mdjs.markdownAsJsTree before or after the cli-markdown call? I tested on Node.js 19.x, OSX terminals.

pathikrit added a commit to pathikrit/chatgpt-cli that referenced this issue Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant