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

Code and blockquotes not displaying as expected #35

Closed
AlexLerman opened this issue Aug 8, 2016 · 3 comments
Closed

Code and blockquotes not displaying as expected #35

AlexLerman opened this issue Aug 8, 2016 · 3 comments

Comments

@AlexLerman
Copy link

I could just be doing something wrong, but this is how the live demo text gets displayed in my app:

screen shot 2016-08-08 at 10 01 52 am

The code while code like is missing the box and the coloring
The blockquote is missing the left-hand bar.

looking at the elements, the code element is very different in my page than it is on the demo page:

Mine:
screen shot 2016-08-08 at 10 38 45 am

Demo:
screen shot 2016-08-08 at 10 38 31 am

My package.json reads:
"react": "^15.2.1",
"react-dom": "^15.1.0",
"react-markdown": "^2.4.2",

Any help would be greatly appreciated! Thanks!

@rexxars
Copy link
Collaborator

rexxars commented Aug 8, 2016

The default configuration doesn't do any syntax highlighting or styling. This means it's up to the implementer to choose how things should look.

Blockquotes can be easily styled. The demo uses the following CSS, for instance:

blockquote {
    color: #666;
    margin: 0;
    padding-left: 3em;
    border-left: 0.5em #eee solid;
}

The demo uses highlight.js for syntax highlighting through a custom renderer.
See demo/src/code-block.js for how that works, and demo/src/demo.js for how to enable the renderer.

Of course, this approach relies on hljs being loaded into the DOM already.

I also have a repository called react-markdown-examples which includes a better (though more complicated) example of syntax highlighting, using react-lowlight.

@rexxars rexxars closed this as completed Aug 8, 2016
@brownbl1
Copy link

Thanks for the comments here. Was looking for the same thing. It might make sense to include a note about the examples repo in the main README.

@DCapella
Copy link

If it helps anyone who comes here later, if you're using bootstrap, it'll automatically help style it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants