testingisdocumenting / znai

Build functional, maintainable, beautiful User Guides with markdown and Znai plugins. Instant pages navigation. Local search. Multiple integrations to work with Python, Java, C++, OpenAPI, etc. Transform "getting started" sections into slideshow for your workshops. Manage multiple documentations with self-deployed znai hub.
https://testingisdocumenting.org/znai
Apache License 2.0
241 stars 13 forks source link

Render Code Segments in Java Callout Comments #1217

Closed TheSilverNimbus closed 2 weeks ago

TheSilverNimbus commented 2 weeks ago

Is there a way I can render a bit of text from a Java comment into monospace (say, with either backticks, the {@code} segment, or some other way)?

For example, let's say I have a class called ClassName defined as follows:

// The `@Generated` annotation is added by the {@code AnnotationProcessor} to
// denote that there are elements of this class that have been generated.
@Generated("pkg.name.AnnotationProcessor")
public class ClassName {
  // ...
}

. . . and, in the markdown, I used:

:include-java: code-snippets/java/output/ClassName.java {
  title: "Title",
  commentsType: "inline",
  wrap: true
}

In this example, I'd like the "\@ Generated" and "AnnotationProcessor" segments to render as @Generated and AnnotationProcessor in the Callout Comment. However, it renders as `@Generated` and `AnnotationProcessor`

Screenshot: image

Additionally, if there's a way to add a Code Reference to each of these segments?

TheSilverNimbus commented 2 weeks ago

Per the instructions in the footer of the Znai documentation, I have posted a question on StackOverflow, making this Issue redundant. So, I'm closing this Issue.

MykolaGolubyev commented 2 weeks ago

@TheSilverNimbus I noticed someone downvoted you. I don't know what the rules are in stack overflow anymore. Maybe could be a good idea to remove markdown and java tags from it since Znai uses custom syntax and it may be perceived as spam.

MykolaGolubyev commented 2 weeks ago

I went ahead and left only znai and documentation tags.

MykolaGolubyev commented 2 weeks ago

@TheSilverNimbus if you don't mind, could you please share how you use Znai here: https://github.com/testingisdocumenting/znai/discussions/824?sort=new

TheSilverNimbus commented 2 weeks ago

@TheSilverNimbus I noticed someone downvoted you. I don't know what the rules are in stack overflow anymore. Maybe could be a good idea to remove markdown and java tags from it since Znai uses custom syntax and it may be perceived as spam.

Yeah, I don't know what the current rules of StackOverflow are, either. And it annoys me so much when they just downvoate without any indication as to why.

In any case, I didn't know about the spam bit; I'll be sure to limit the tags, next time. Thanks for both the snappy response and the heads-up!