Skip to content
Merged
Show file tree
Hide file tree
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
21 changes: 21 additions & 0 deletions docs/javascript/copy-page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
document.addEventListener('click', function(e) {
var btn = e.target.closest('#copy-page-btn');
if (!btn) return;

var svg = btn.querySelector('svg');
var orig = svg.innerHTML;
var check = '<path d="M9 16.17L4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z"/>';
var x = '<path d="M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/>';

fetch(btn.dataset.url)
.then(function(r) { return r.text(); })
.then(function(t) {
navigator.clipboard.writeText(t);
svg.innerHTML = check;
setTimeout(function() { svg.innerHTML = orig; }, 1500);
})
.catch(function() {
svg.innerHTML = x;
setTimeout(function() { svg.innerHTML = orig; }, 1500);
});
});
12 changes: 12 additions & 0 deletions docs/stylesheets/custom.css
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,18 @@
width: 100%;
}

/* Copy page button */

button.md-content__button {
background: none;
border: none;
cursor: pointer;
}

button.md-content__button:hover svg {
color: var(--md-accent-fg-color);
}

/* YouTube video grid */

.video-grid {
Expand Down
10 changes: 9 additions & 1 deletion mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ extra_css:
- stylesheets/custom.css
- stylesheets/language-tags.css

# Custom JavaScript
extra_javascript:
- javascript/copy-page.js

# Additional config
extra:
first_repo_url: https://github.com/google/adk-python
Expand Down Expand Up @@ -154,14 +158,15 @@ plugins:
Build Agents:
- get-started/*.md
- tutorials/*.md
- visual-builder/*.md
- agents/*.md
- tools/*.md
- tools-custom/*.md
Run Agents:
- runtime/*.md
- deploy/*.md
- observability/*.md
- evaluation/*.md
- evaluate/*.md
- safety/*.md
Components:
- context/*.md
Expand All @@ -176,8 +181,11 @@ plugins:
- streaming/*.md
- grounding/*.md
Reference:
- release-notes.md
- api-reference/index.md
- api-reference/rest/index.md
- community.md
- contributing-guide.md

# Navigation
nav:
Expand Down
23 changes: 23 additions & 0 deletions overrides/partials/actions.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{% if page.edit_url and page.file.src_path != "index.md" %}
{% if "content.action.edit" in features %}
<a href="{{ page.edit_url }}" title="Edit this page on GitHub" class="md-content__button md-icon" rel="edit">
{% set icon = config.theme.icon.edit or "material/file-edit-outline" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</a>
{% endif %}
{% if "content.action.view" in features %}
{% if "/blob/" in page.edit_url %}
{% set part = "blob" %}
{% else %}
{% set part = "edit" %}
{% endif %}
<a href="{{ page.edit_url | replace(part, 'raw') }}" title="View Markdown source" class="md-content__button md-icon">
{% set icon = config.theme.icon.view or "material/file-eye-outline" %}
{% include ".icons/" ~ icon ~ ".svg" %}
</a>
{% endif %}
{% set raw_url = page.url | url ~ "index.md" %}
<button id="copy-page-btn" class="md-content__button md-icon" title="Copy page as Markdown" data-url="{{ raw_url }}">
{% include ".icons/material/content-copy.svg" %}
</button>
{% endif %}
Loading