Skip to content

Commit 35ad6cf

Browse files
javier-godoypaodb
authored andcommitted
docs(readme): document SourceUrlResolver
1 parent 6592c7c commit 35ad6cf

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,26 @@ The rendering process consists of the following steps:
5555
5. Post-processing (fragment highlighting)
5656

5757
### Source code retrieval
58-
The specified URL (refer to the explanation of `@DemoSource` above) will be used to fetch sources. URLs pointing to `github.com` will be rewritten into `raw.githubusercontent.com` URLs. In development mode, sources will be retrieved from the local `src` directory (if available).
58+
The specified URL (refer to the explanation of `@DemoSource` above) will be used to fetch sources. In development mode, sources will be retrieved from the local `src` directory (if available).
5959

60+
By default, URLs pointing to `github.com` will be rewritten into `raw.githubusercontent.com` URLs. A custom `SourceUrlResolver` can be configured to modify this behavior.
61+
62+
```java
63+
@Component
64+
public final class SourceUrlResolverImpl implements SourceUrlResolver, VaadinServiceInitListener {
65+
66+
@Override
67+
public void serviceInit(ServiceInitEvent event) {
68+
TabbedDemo.configureSourceUrlResolver(this);
69+
}
70+
71+
@Override
72+
public Optional<String> resolveURL(TabbedDemo demo, Class<?> annotatedClass, DemoSource annotation) {
73+
return ...;
74+
}
75+
76+
}
77+
```
6078
### License abbreviation
6179

6280
A license comment block at the beginning of the file will be replaced with a short two-lines comment (author, year and link to the license terms), provided that:

0 commit comments

Comments
 (0)