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

GFM: Code blocks are not supported #2074

Closed
ZacSweers opened this issue Aug 15, 2021 · 1 comment
Closed

GFM: Code blocks are not supported #2074

ZacSweers opened this issue Aug 15, 2021 · 1 comment
Labels
bug format: gfm An issue/PR related to Dokka's GFM output format

Comments

@ZacSweers
Copy link

ZacSweers commented Aug 15, 2021

Describe the bug
Code blocks are written out in an unformatted way

Expected behaviour
They should be a proper code block

Screenshots
image

To Reproduce

/**
 * A simple Gradle plugin that hooks into Proguard/R8 to add extra keep rules based on what androidTest classes use from
 * the target app's sources. This is necessary because AGP does not factor in androidTest usages of target app sources
 * when running the minification step, which can result in runtime errors if APIs used by tests are removed.
 *
 * This is a workaround until AGP supports this: https://issuetracker.google.com/issues/126429384.
 *
 * This is optionally configurable via the [`keeper`][KeeperExtension] extension. For example:
 *
 * ```kotlin
 * keeper {
 *   automaticR8RepoManagement = false
 *   r8JvmArgs = ["-Xdebug", "-Xrunjdwp:transport=dt_socket,address=5005,server=y,suspend=y"]
 * }
 * ```
 *
 * The general logic flow:
 * - Create a custom `r8` configuration for the R8 dependency.
 * - Register two jar tasks. One for all the classes in its target `testedVariant` and one for all
 *   the classes in the androidTest variant itself. This will use their variant-provided [JavaCompile]
 *   tasks and [KotlinCompile] tasks if available.
 * - Register a [`infer${androidTestVariant}UsageForKeeper`][InferAndroidTestKeepRules] task that
 *   plugs the two aforementioned jars into R8's `PrintUses` or `TraceReferences` CLI and outputs
 *   the inferred proguard rules into a new intermediate .pro file.
 * - Finally - the generated file is wired in to Proguard/R8 via private task APIs and setting
 *   their `configurationFiles` to include our generated one.
 *
 * Appropriate task dependencies (via inputs/outputs, not `dependsOn`) are set up, so this is automatically run as part
 * of the target app variant's full minified APK.
 *
 * The tasks themselves take roughly ~20 seconds total extra work in the Slack android app, with the infer and app jar
 * tasks each taking around 8-10 seconds and the androidTest jar taking around 2 seconds.
 */

And is from this project: https://github.com/slackhq/keeper

Dokka configuration
Configuration of dokka used to reproduce the bug

tasks.withType<DokkaTask>().configureEach {
  outputDirectory.set(rootDir.resolve("../docs/0.x"))
  dokkaSourceSets.configureEach {
    skipDeprecated.set(true)
    suppressInheritedMembers.set(true)
    externalDocumentationLink {
      url.set(URL("https://docs.gradle.org/${gradle.gradleVersion}/javadoc/index.html"))
    }
    externalDocumentationLink {
      packageListUrl.set(URL("https://developer.android.com/reference/tools/gradle-api/7.0/package-list"))
      url.set(URL("https://developer.android.com/reference/tools/gradle-api/7.0/classes"))
    }
  }
}

Installation

  • Operating system: macOS Big Sur
  • Build tool: Gradle v7.1.1
  • Dokka version: 1.5.0

Additional context
Ideally it would also include the language tags at the beginning of the block, but understandable if it can't. This doesn't work both with or without the language tag

@ZacSweers ZacSweers added the bug label Aug 15, 2021
@MarcinAman MarcinAman added the format: gfm An issue/PR related to Dokka's GFM output format label Aug 21, 2021
@IgnatBeresnev
Copy link
Member

I believe the simplest cases for code blocks in GFM have been supported in #2485. The fix was shipped in Kotlin 1.7.0

2023-03-08_04-32-43


So I'll close the issue for now, but let us know if you stumble upon it again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug format: gfm An issue/PR related to Dokka's GFM output format
Projects
None yet
Development

No branches or pull requests

3 participants