aider: The JavaScript code now adds the mdurl as an href on the <a> tag.

# Aider chat conversation:

USER: have the js add the mdurl as an href on the <a>

ASSISTANT: To add the `mdurl` as an `href` on the `<a>` tag, we need to modify the `share/index.md` file.

Here are the steps:

1. Find the `<a>` tag that we want to modify.
2. Add a JavaScript code snippet that will get the `mdurl` from the URL parameters and set it as the `href` of the `<a>` tag.

Here is the *edit block* for the change:

<source>markdown
share/index.md
<<<<<<< HEAD
A user has shared the following transcript of a pair programming chat session
created using <a href="https://aider.chat">aider</a>.
=======
A user has shared the following
^C KeyboardInterrupt

USER: have the js add the mdurl as an href on the <a>

ASSISTANT: To add the `mdurl` as an `href` on the `<a>` tag, we need to modify the `share/index.md` file.

Here are the steps:

1. Find the `<a>` tag that we want to modify.
2. Add a JavaScript code snippet that will get the `mdurl` from the URL parameters and set it as the `href` of the `<a>` tag.

Here is the *edit block* for the change:

<source>markdown
share/index.md
<<<<<<< HEAD
The transcript is based on <a id="mdurl">this chat transcript data</a>.
=======
The transcript is based on <a id="mdurl" href="">this chat transcript data</a>.
>>>>>>> updated
</source>

<source>javascript
share/index.md
<<<<<<< HEAD
    var conv = urlParams.get('mdurl');
    if (!conv) {
        return;
    }
=======
    var conv = urlParams.get('mdurl');
    if (!conv) {
        return;
    }
    document.getElementById('mdurl').href = conv;
>>>>>>> updated
</source>
This commit is contained in:
Paul Gauthier 2023-08-14 14:40:47 -03:00
parent 56a97c4c13
commit 097a9ebf20

View file

@ -6,8 +6,7 @@ created using <a href="https://aider.chat">aider</a>.
Aider is a command line tool that lets you pair program with GPT-3.5 or Aider is a command line tool that lets you pair program with GPT-3.5 or
GPT-4, to edit code stored in your local git repository. GPT-4, to edit code stored in your local git repository.
The transcript is based on <a id="mdurl" href="">this chat transcript data</a>.
## Shared chat transcript
<div class="chat-transcript" id="shared-transcript"> <div class="chat-transcript" id="shared-transcript">
</div> </div>
@ -42,6 +41,7 @@ window.onload = function() {
if (!conv) { if (!conv) {
return; return;
} }
document.getElementById('mdurl').href = conv;
// Check if the URL is a non-raw GitHub gist // Check if the URL is a non-raw GitHub gist
var gistRegex = /^https:\/\/gist\.github\.com\/([^\/]+)\/([a-f0-9]+)$/; var gistRegex = /^https:\/\/gist\.github\.com\/([^\/]+)\/([a-f0-9]+)$/;
var match = gistRegex.exec(conv); var match = gistRegex.exec(conv);