Naoto-Ida / react-native-syntax-highlighter

0 stars 0 forks source link

use react syntax highlighter with custom renderer #1

Open conorhastings opened 7 years ago

conorhastings commented 7 years ago

with custom renderer you should be able to map DOM tags to appropriate native tags.

It should get in soon -- see this PR -- https://github.com/conorhastings/react-syntax-highlighter/pull/54/files

Naoto-Ida commented 7 years ago

@conorhastings Hey, thanks for starting a new issue on a project I was about to start(and maybe saved me the hassle of writing it) :) I don't know how you found this haha

I checked out your PR, but it still contains <pre> and <code> tags... these need to be replaced in order for it to work on RN, correct?

conorhastings commented 7 years ago

@Naoto-Ida yeah that's a good point. potentially we could solve that by allowing optional codeElement and preElement props, that could be used by custom renderers targeting non web platforms

conorhastings commented 7 years ago

btw, I found it searching react-syntax-highlighter on github, ha.

Naoto-Ida commented 7 years ago

@conorhastings OK. Could I start investigating that? I kind of need it for my app so was planning on writing a RN version of what you did, but if it can work without having two repositories, then that would be great.

conorhastings commented 7 years ago

@Naoto-Ida for sure! go for it

conorhastings commented 7 years ago

I'm going to try to land the custom renderer pr this weekend, if you want to work on submitting a PR allowing custom elements for code and pre tags, then I would recommend still using this repository but just to house the custom renderer.

Naoto-Ida commented 7 years ago

@conorhastings 'this' being your repo?

conorhastings commented 7 years ago

sorry @Naoto-Ida by this i meant the repo this issue is in, doing something similar to this -- https://github.com/conorhastings/react-syntax-highlighter-virtualized-renderer with a custom renderer, though it will also require the replace of the pre and code elements.