question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hi there, awesome light little library 😃

I’ve identified a few issues with code blocks, they are as follows:

  • overrides code does not differentiate between the 3 code types internally, should be able to render differently based on the type of code node
  • code blocks with 3 tick mark render as inlineCode if not preceded by two new lines

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:17
  • Comments:9

github_iconTop GitHub Comments

4reactions
trulyronakcommented, Aug 25, 2020

Bump on this issue — markdown still renders CodeBlock content for inline code elements

1reaction
CodyClinecommented, Jul 29, 2020

One workaround is to create your code block with a highlighter of your choice (I used prismjs) and add it to the overrides as a custom component. I did this and it a allowed me to have a custom code blocks and an inline code that work nicely together.

Within markdown, All I had to do was call the codeblock like this <MyCodeBlock> and use inline code like this `code` . This may not be the best solution for everyone, but it suits my needs very well for the moment.

Implementation below:

import React from 'react';
import Markdown from 'markdown-to-jsx';
import { CodeBlock, InlineCode } from 'dir/to/your/component';

//Test string
const testMD = (`
#Title
This is some inline \`code\` to view.

<MyCodeBlock language="javascript">
const x = "myCodeBlock";
</MyCodeBlock
`);

<Markdown
  children={testMD} //Or other prop
  options={{
    overrides: { 
    code: InlineCode
    MyCodeBlock: CodeBlock,

    }
  }}
/>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Common problems and solutions - Code::Blocks
1 I cannot use the debugger. 1.1 Problem · 2 Multi-targets library and executable ignore interdependence. 2.1 Problem · 3 I want to...
Read more >
Creating and highlighting code blocks - GitHub Docs
Share samples of code with fenced code blocks and enabling syntax highlighting.
Read more >
Codeblocks can't build and run any code - YouTube
In case of wrong settings, you may run into errors while compiling program in code blocks. types of issues. Thanks for watching and...
Read more >
Code blocks - Squarespace Help Center
Use code blocks to add custom code to a page, blog post, sidebar, footer, ... If code block issues prevent you from editing...
Read more >
Vue 3 CKEditor 5 Add Plugins CodeBlock Error Duplicate ...
The build package contains a file that is already compiled with webpack. This means that it contains all the necessary code.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found