Skip to content

Commit c9435f2

Browse files
add a shortcode for linking to github when disableCodeBlock=true (SeleniumHQ#935)[deploy site]
* add a shortcode for linking to github when disableCodeBlock=true * Update website_and_docs/content/documentation/about/style.en.md fix extraneous character Co-authored-by: Sri Harsha <[email protected]>
1 parent 10461e5 commit c9435f2

File tree

5 files changed

+163
-25
lines changed

5 files changed

+163
-25
lines changed

website_and_docs/content/documentation/about/style.en.md

Lines changed: 36 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -151,10 +151,36 @@ This auto-formats the code in each tab to match the header name.
151151
{{</* /tab */>}}
152152
{{</* /tabpane */>}}
153153

154+
#### Link to GitHub
155+
156+
All code examples should be present and linked to in our example repos: https://github.com/SeleniumHQ/seleniumhq.github.io/tree/dev/examples
157+
158+
With `langEqualsHeader=true`, you can add GitHub links at the bottom of the given tab like this:
159+
160+
{{</* tabpane */>}}
161+
{{</* tab header="Link" github="SeleniumHQ/seleniumhq.github.io/tree/dev/examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35 */>}}
162+
Content in automatic code block that refers to something on GitHub
163+
{{</* /tab */>}}
164+
{{</* tab header="No Link" */>}}
165+
This content should not get linked to GitHub
166+
{{</* /tab */>}}
167+
{{</* /tabpane */>}}
168+
169+
Which looks like this:
170+
171+
{{< tabpane >}}
172+
{{< tab header="Link" github="SeleniumHQ/seleniumhq.github.io/tree/dev/examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" >}}
173+
Content in automatic code block that refers to something on GitHub
174+
{{< /tab >}}
175+
{{< tab header="No Link" >}}
176+
This content should not get linked to GitHub
177+
{{< /tab >}}
178+
{{< /tabpane >}}
179+
154180
### Disabling Code Block
155181

156182
If you want your example to include both text and code, you
157-
need to disable the default of everything being put in a code block
183+
need to disable the default behavior that puts everything inside a code block
158184

159185
Maybe you want something like this:
160186

@@ -197,31 +223,19 @@ You need to specify which parts are code and which are not yourself now, like th
197223
< ... >
198224
{{</* /tabpane */>}}
199225

200-
### Link to GitHub
226+
#### Link to GitHub
201227

202-
If you disable code blocks, you can create whatever kind of link anywhere you want.
203-
But say you want to add a GitHub link associated with a given tab when using the default code block:
204-
{{< tabpane >}}
205-
{{< tab header="Link" github="seleniumhq/seleniumhq.github.io/blob/dev/website_and_docs/content/documentation/about/style.en.md#L205" >}}
206-
Content in automatic code block that refers to something on GitHub
207-
{{< /tab >}}
208-
{{< tab header="No Link" >}}
209-
This content should not get linked to GitHub
210-
{{< /tab >}}
211-
{{< /tabpane >}}
228+
All code examples should be present and linked to in our example repos: https://github.com/SeleniumHQ/seleniumhq.github.io/tree/dev/examples
212229

213-
To add a link to a particular tab, pass in a `github` value
214-
to that tab. Note that only the tabs that have this value will have the link added.
230+
With `disableCodeBlock=true`, you can add GitHub links wherever you need them with this shortcode:
215231

216-
{{</* tabpane */>}}
217-
{{</* tab header="Link" github="seleniumhq/seleniumhq.github.io/blob/dev/website_and_docs/content/documentation/about/style.en.md#L205" */>}}
218-
Content in automatic code block that refers to something on GitHub
219-
{{</* /tab */>}}
220-
{{</* tab header="No Link" */>}}
221-
This content should not get linked to GitHub
222-
{{</* /tab */>}}
223-
{{</* /tabpane */>}}
232+
{{</* gh-content "java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" */>}}
233+
234+
Which looks like this:
224235

236+
<span class="tab-pane">
237+
{{< gh-content "java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" >}}
238+
</span>
225239

226240
### Code Comments
227241

website_and_docs/content/documentation/about/style.ja.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,36 @@ This auto-formats the code in each tab to match the header name.
152152
{{</* /tab */>}}
153153
{{</* /tabpane */>}}
154154

155+
#### Link to GitHub
156+
157+
All code examples should be present and linked to in our example repos: https://github.com/SeleniumHQ/seleniumhq.github.io/tree/dev/examples
158+
159+
With `langEqualsHeader=true`, you can add GitHub links at the bottom of the given tab like this:
160+
161+
{{</* tabpane */>}}
162+
{{</* tab header="Link" github="SeleniumHQ/seleniumhq.github.io/tree/dev/examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35 */>}}
163+
Content in automatic code block that refers to something on GitHub
164+
{{</* /tab */>}}
165+
{{</* tab header="No Link" */>}}
166+
This content should not get linked to GitHub
167+
{{</* /tab */>}}
168+
{{</* /tabpane */>}}
169+
170+
Which looks like this:
171+
172+
{{< tabpane >}}
173+
{{< tab header="Link" github="SeleniumHQ/seleniumhq.github.io/tree/dev/examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" >}} /
174+
Content in automatic code block that refers to something on GitHub
175+
{{< /tab >}}
176+
{{< tab header="No Link" >}}
177+
This content should not get linked to GitHub
178+
{{< /tab >}}
179+
{{< /tabpane >}}
180+
155181
### Disabling Code Block
156182

157183
If you want your example to include both text and code, you
158-
need to disable the default of everything being put in a code block
184+
need to disable the default behavior that puts everything inside a code block
159185

160186
Maybe you want something like this:
161187

@@ -198,6 +224,20 @@ You need to specify which parts are code and which are not yourself now, like th
198224
< ... >
199225
{{</* /tabpane */>}}
200226

227+
#### Link to GitHub
228+
229+
All code examples should be present and linked to in our example repos: https://github.com/SeleniumHQ/seleniumhq.github.io/tree/dev/examples
230+
231+
With `disableCodeBlock=true`, you can add GitHub links wherever you need them with this shortcode:
232+
233+
{{</* gh-content "java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" */>}}
234+
235+
Which looks like this:
236+
237+
<span class="tab-pane">
238+
{{< gh-content "java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" >}}
239+
</span>
240+
201241
### Code Comments
202242

203243
Minimize code comments because they are difficult to translate.

website_and_docs/content/documentation/about/style.pt-br.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,36 @@ This auto-formats the code in each tab to match the header name.
152152
{{</* /tab */>}}
153153
{{</* /tabpane */>}}
154154

155+
#### Link to GitHub
156+
157+
All code examples should be present and linked to in our example repos: https://github.com/SeleniumHQ/seleniumhq.github.io/tree/dev/examples
158+
159+
With `langEqualsHeader=true`, you can add GitHub links at the bottom of the given tab like this:
160+
161+
{{</* tabpane */>}}
162+
{{</* tab header="Link" github="SeleniumHQ/seleniumhq.github.io/tree/dev/examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35 */>}}
163+
Content in automatic code block that refers to something on GitHub
164+
{{</* /tab */>}}
165+
{{</* tab header="No Link" */>}}
166+
This content should not get linked to GitHub
167+
{{</* /tab */>}}
168+
{{</* /tabpane */>}}
169+
170+
Which looks like this:
171+
172+
{{< tabpane >}}
173+
{{< tab header="Link" github="SeleniumHQ/seleniumhq.github.io/tree/dev/examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" >}} /
174+
Content in automatic code block that refers to something on GitHub
175+
{{< /tab >}}
176+
{{< tab header="No Link" >}}
177+
This content should not get linked to GitHub
178+
{{< /tab >}}
179+
{{< /tabpane >}}
180+
155181
### Disabling Code Block
156182

157183
If you want your example to include both text and code, you
158-
need to disable the default of everything being put in a code block
184+
need to disable the default behavior that puts everything inside a code block
159185

160186
Maybe you want something like this:
161187

@@ -198,6 +224,20 @@ You need to specify which parts are code and which are not yourself now, like th
198224
< ... >
199225
{{</* /tabpane */>}}
200226

227+
#### Link to GitHub
228+
229+
All code examples should be present and linked to in our example repos: https://github.com/SeleniumHQ/seleniumhq.github.io/tree/dev/examples
230+
231+
With `disableCodeBlock=true`, you can add GitHub links wherever you need them with this shortcode:
232+
233+
{{</* gh-content "java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" */>}}
234+
235+
Which looks like this:
236+
237+
<span class="tab-pane">
238+
{{< gh-content "java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" >}}
239+
</span>
240+
201241
### Code Comments
202242

203243
Minimize code comments because they are difficult to translate.

website_and_docs/content/documentation/about/style.zh-cn.md

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,36 @@ This auto-formats the code in each tab to match the header name.
152152
{{</* /tab */>}}
153153
{{</* /tabpane */>}}
154154

155+
#### Link to GitHub
156+
157+
All code examples should be present and linked to in our example repos: https://github.com/SeleniumHQ/seleniumhq.github.io/tree/dev/examples
158+
159+
With `langEqualsHeader=true`, you can add GitHub links at the bottom of the given tab like this:
160+
161+
{{</* tabpane */>}}
162+
{{</* tab header="Link" github="SeleniumHQ/seleniumhq.github.io/tree/dev/examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35 */>}}
163+
Content in automatic code block that refers to something on GitHub
164+
{{</* /tab */>}}
165+
{{</* tab header="No Link" */>}}
166+
This content should not get linked to GitHub
167+
{{</* /tab */>}}
168+
{{</* /tabpane */>}}
169+
170+
Which looks like this:
171+
172+
{{< tabpane >}}
173+
{{< tab header="Link" github="SeleniumHQ/seleniumhq.github.io/tree/dev/examples/java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" >}} /
174+
Content in automatic code block that refers to something on GitHub
175+
{{< /tab >}}
176+
{{< tab header="No Link" >}}
177+
This content should not get linked to GitHub
178+
{{< /tab >}}
179+
{{< /tabpane >}}
180+
155181
### Disabling Code Block
156182

157183
If you want your example to include both text and code, you
158-
need to disable the default of everything being put in a code block
184+
need to disable the default behavior that puts everything inside a code block
159185

160186
Maybe you want something like this:
161187

@@ -198,6 +224,20 @@ You need to specify which parts are code and which are not yourself now, like th
198224
< ... >
199225
{{</* /tabpane */>}}
200226

227+
#### Link to GitHub
228+
229+
All code examples should be present and linked to in our example repos: https://github.com/SeleniumHQ/seleniumhq.github.io/tree/dev/examples
230+
231+
With `disableCodeBlock=true`, you can add GitHub links wherever you need them with this shortcode:
232+
233+
{{</* gh-content "java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" */>}}
234+
235+
Which looks like this:
236+
237+
<span class="tab-pane">
238+
{{< gh-content "java/src/test/java/dev/selenium/getting_started/FirstScriptTest.java#L16-L35" >}}
239+
</span>
240+
201241
### Code Comments
202242

203243
Minimize code comments because they are difficult to translate.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{ $path := .Get 0 }}
2+
<div class="github nocode">
3+
<a href ="https://github.com/SeleniumHQ/seleniumhq.github.io/blob/dev/examples/{{ $path }}">See full example on GitHub.</a>
4+
</div>

0 commit comments

Comments
 (0)