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

feature: linking doc snippets to our repo #1725

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/src/modules/java/pages/event-sourced-entities.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ Now that we have our Entity state defined along with its events, the remaining s

Let's have a look at what our shopping cart entity will look like for the first 2 steps from the above list:

[source,java]
.src/main/java/com/example/shoppingcart/ShoppingCartEntity.java
https://github.com/lightbend/kalix-jvm-sdk/blob/main/samples/java-spring-eventsourced-shopping-cart/src/main/java/com/example/shoppingcart/ShoppingCartEntity.java[src/main/java/com/example/shoppingcart/ShoppingCartEntity.java]
Copy link
Member

@octonato octonato Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a good idea, IMO

but we need to preserve

[source,java]
.

This is need for the syntax highlight on the included snippet.

The . needs to be just before the line. This is to apply a special style to the line showing the file name.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. I'll go ahead then.
This is how it would look

Screenshot 2023-07-03 at 10 21 34

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should rather look like this if syntax highlight is added.

CleanShot 2023-07-10 at 10 54 51

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be neat if it could be a little bit more automatic than providing full paths everywhere, like links we do in paradox where the repo url is listed once and given a name that can be linked to with @extref.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can use some asciidoc variables, but that won't be fully automatic.

The problem is that we need to split the line in three as well:

  1. https://github.com/lightbend/kalix-jvm-sdk/blob/main/
  2. samples/java-spring-eventsourced-shopping-cart/
  3. src/main/java/com/example/shoppingcart/ShoppingCartEntity.java

(1) can be on a variable, (2) is a specific path that we don't want to render on the page and (3) is what we want to render.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was looking at docs today and this crossed my mind.. I'm not really sure if hiding the samples/java-spring-eventsourced-shopping-cart/ is too big of an advantage.. I understand that approach when we, in the context of a page, are always using examples from the same repo and that is clearly mentioned somewhere.. because then it's obvious that is a relative path inside the mentioned codebase. But in our docs, it's not always clear what repo is associated with the context and having the sample there would help to contextualize I think. And that could make it easier to automate the process I suppose.

----
include::example$java-spring-eventsourced-shopping-cart/src/main/java/com/example/shoppingcart/ShoppingCartEntity.java[tag=class]
----
Expand Down
Loading