okhttp icon indicating copy to clipboard operation
okhttp copied to clipboard

Code example box in the docs

Open Deceptio opened this issue 3 years ago • 8 comments

The code examples are difficult to read because they are in the "normal" text OkHttpClient image

authenticator image

Maybe you could make a codebox like on this page Recipes image

Deceptio avatar Feb 22 '22 10:02 Deceptio

Hi, I'm interested in working on this issue. This would be my first time contributing. Can it be assigned to me?

rattanshiv12 avatar Aug 05 '22 16:08 rattanshiv12

Yes, thanks, please take a look. I can point you at some of the documentation processes after I get home.

yschimke avatar Aug 05 '22 16:08 yschimke

@yschimke Sure, that would be great, thank you. Also, I was wondering how I can locally test my changes and view the documentation as it would appear on https://square.github.io/okhttp/4.x/okhttp/okhttp3/-ok-http-client/

rattanshiv12 avatar Aug 05 '22 19:08 rattanshiv12

Take a look at this test script, which should generate a local site directory https://github.com/square/okhttp/pull/7414

yschimke avatar Aug 06 '22 11:08 yschimke

@yschimke Hey again. Thanks for the test script. It is super helpful for rendering the docs. So I have been trying to get the code blocks to work properly in the inline KDocs markdown, but it doesn't seem to work as expected. For example this snippet: ''' // The singleton HTTP client. public final OkHttpClient client = new OkHttpClient(); ''' does not render as code. (using single quotes instead of back-ticks here since the comments support markdown)

The same thing with the code indented: ''' <4 SPACES>// The singleton HTTP client. <4 SPACES>public final OkHttpClient client = new OkHttpClient(); ''' does render as a code block, but now the issue I see is that the rendered code block appends a '' character at the end of each line. I have tried many different syntaxes as well as adding 2 spaces at the end of each line to stop this behavior but it won't seem to work. Just wondering if you have any advice here as its a very specific issue that I don't see anyone else having with KDoc and Dokka.

rattanshiv12 avatar Aug 11 '22 17:08 rattanshiv12

Sorry, Not sure I can help here. Maybe raise a bug at https://github.com/Kotlin/dokka and link to the branch with a reproduction.

So options we've tried

"'''java" - current ones that don't render "'''" - tried as well "<4 spaces>" - tried but leaving additional character at end of line

You could also try bumping the dokka plugin? gradlePlugin-dokka = "org.jetbrains.dokka:dokka-gradle-plugin:1.6.21"

yschimke avatar Aug 12 '22 08:08 yschimke

Sure, sounds good. bumping dokka to 1.7.10 seems to do the trick. I just raised a PR for that. I raised a bug with Dokka and they validated that code blocks are supported with 1.7.0 and above.

rattanshiv12 avatar Aug 12 '22 18:08 rattanshiv12

Should be fixed on next release.

yschimke avatar Aug 14 '22 09:08 yschimke

Hi, I'm interested in contributing to this issue. This would be my first open-source contribution. Can it be assigned to me?

anishcode19 avatar Sep 25 '22 06:09 anishcode19

Sorry, should already be fixed with https://github.com/square/okhttp/pull/7421

yschimke avatar Sep 25 '22 08:09 yschimke