Skip to content
Open
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
6 changes: 3 additions & 3 deletions copy_markdown.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@
* Copies the source Markdown files into the generated site, so every page is
* also available in its original Markdown form.
*
* `doc/book/v7/introduction/introduction.md` is copied to
* `doc/html/v7/introduction/introduction.md`, making it available as
* `docs/book/v7/introduction/introduction.md` is copied to
* `docs/html/v7/introduction/introduction.md`, making it available as
* `<site_url>/v7/introduction/introduction.md`, next to the generated
* `<site_url>/v7/introduction/introduction/` page.
*
* This must run after `mkdocs build --clean`, as that empties the output
* directory.
*/

$docPath = isset($argv[1]) ? $argv[1] : 'doc';
$docPath = $argv[1] ?? 'docs';
$docPath = sprintf('%s/%s', getcwd(), $docPath);
$docPath = realpath($docPath);

Expand Down
47 changes: 39 additions & 8 deletions theme/partials/content.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,46 @@
<!-- <h2 class="chapter__headline text-black-50">{{ page.parent.title }}</h2>-->
{% endif %}

{# Link to the Markdown source, published next to this page by copy_markdown.php #}
{# Markdown Controls #}
{% if page.file and page.file.src_uri %}
<p class="view-as-markdown text-end small mb-2">
<a href="{{ page.file.src_uri|url }}" class="text-body-secondary text-decoration-none"
type="text/markdown" rel="alternate" title="View the Markdown source of this page">
<i class="bi bi-filetype-md"></i>
View as Markdown
</a>
</p>
{% set markdown_url = page.file.src_uri|url %}
{% if config.site_url %}
{% set markdown_full_url = config.site_url ~ page.file.src_uri %}
{% else %}
{% set markdown_full_url = markdown_url %}
{% endif %}
{% set claude_prompt = 'Read from ' ~ markdown_full_url ~ ' so I can ask questions about it.' %}
<div class="md-actions-bar">
<div class="md-actions">
<button type="button" class="md-actions-toggle" aria-haspopup="true" aria-expanded="false"
onclick="toggleMdActionsMenu(this)">
<span class="md-actions-toggle-label">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h9l7 7v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"/><path d="M13 4v6h6"/></svg>
<span>Copy Page</span>
</span>
<span class="md-actions-toggle-chev">
<svg class="chev" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M6 9l6 6 6-6"/></svg>
</span>
</button>
<div class="md-actions-menu" role="menu">
<button type="button" class="md-actions-item" role="menuitem" data-copy-url="{{ markdown_url }}"
onclick="copyMarkdownPage(this)">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><rect x="9" y="9" width="11" height="11" rx="2"/><path d="M5 15V5a2 2 0 0 1 2-2h10"/></svg>
<span class="label">Copy Page (as Markdown)</span>
</button>
<a href="{{ markdown_url }}" target="_blank" rel="alternate noopener noreferrer" type="text/markdown"
class="md-actions-item" role="menuitem" title="View the Markdown source of this page">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M4 4h9l7 7v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2z"/><path d="M13 4v6h6"/><path d="M8 15h8M8 11h4"/></svg>
<span class="label">View as Markdown</span>
</a>
<a href="https://claude.ai/new?q={{ claude_prompt|urlencode }}" target="_blank" rel="noopener noreferrer"
class="md-actions-item" role="menuitem" title="Open this page in Claude">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 3l2.5 5.5L20 11l-5.5 2.5L12 19l-2.5-5.5L4 11l5.5-2.5z"/></svg>
<span class="label">Open in Claude</span>
</a>
</div>
</div>
</div>
{% endif %}

{{ page.content }}
Expand Down