Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove AI Explain #9210

Closed
wants to merge 2 commits into from
Closed
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
3 changes: 0 additions & 3 deletions .github/workflows/prod-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ jobs:
BUILD_LIVE_SAMPLES_BASE_URL: https://live.mdnplay.dev
BUILD_LEGACY_LIVE_SAMPLES_BASE_URL: https://live-samples.mdn.mozilla.net

# Sign key for code samples
BUILD_SAMPLE_SIGN_KEY: ${{ secrets.SAMPLE_SIGN_KEY }}

# Now is not the time to worry about flaws.
BUILD_FLAW_LEVELS: "*:ignore"

Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ jobs:
BUILD_LIVE_SAMPLES_BASE_URL: https://live.mdnyalp.dev
BUILD_LEGACY_LIVE_SAMPLES_BASE_URL: https://live-samples.mdn.allizom.net

# Sign key for code samples
BUILD_SAMPLE_SIGN_KEY: ${{ secrets.SAMPLE_SIGN_KEY }}

# Use the stage version of interactive examples.
BUILD_INTERACTIVE_EXAMPLES_BASE_URL: https://interactive-examples.mdn.allizom.net

Expand Down
20 changes: 6 additions & 14 deletions build/syntax-highlight.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import Prism from "prismjs";
import loadLanguages from "prismjs/components/index.js";
import "prism-svelte";
import * as cheerio from "cheerio";
import { createHmac } from "node:crypto";
import { SAMPLE_SIGN_KEY } from "../libs/env/index.js";

const lazy = (creator) => {
let res;
Expand Down Expand Up @@ -107,19 +105,12 @@ export function syntaxHighlight($: cheerio.CheerioAPI, doc) {
// Seems to exist a couple of these in our docs. Just bail.
return;
}
const code = $pre.text();
if (SAMPLE_SIGN_KEY) {
const hmac = createHmac("sha256", SAMPLE_SIGN_KEY);
hmac.update(name.toLowerCase());
hmac.update(code);
const signature = hmac.digest("base64");
$pre.attr("data-signature", signature);
}
$pre.wrapAll(`<div class='code-example'></div>`);
if (!$pre.hasClass("hidden")) {
$(
`<p class='example-header'><span class="language-name">${name}</span></p>`
).insertBefore($pre);
$pre.wrapAll(
`<div class='code-example'><p class='example-header'><span class="language-name">${name}</span></p></div>`
);
} else {
$pre.wrapAll(`<div class='code-example'></div>`);
}
const grammar = Prism.languages[name];
if (!grammar) {
Expand All @@ -128,6 +119,7 @@ export function syntaxHighlight($: cheerio.CheerioAPI, doc) {
);
return; // bail!
}
const code = $pre.text();
const html = Prism.highlight(code, grammar, name);
const $code = $("<code>").html(html);

Expand Down
7 changes: 2 additions & 5 deletions client/src/blog/post.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ import {
BlogPostLimitedMetadata,
AuthorMetadata,
} from "../../../libs/types/blog";
import {
useCopyExamplesToClipboardAndAIExplain,
useRunSample,
} from "../document/hooks";
import { useCopyExamplesToClipboard, useRunSample } from "../document/hooks";
import { DEFAULT_LOCALE } from "../../../libs/constants";
import { SignUpSection as NewsletterSignUp } from "../newsletter";

Expand Down Expand Up @@ -187,7 +184,7 @@ export function BlogPost(props: HydrationData) {
);
const { doc, blogMeta } = data || props || {};
useRunSample(doc);
useCopyExamplesToClipboardAndAIExplain(doc);
useCopyExamplesToClipboard(doc);
return (
<>
{doc && blogMeta && (
Expand Down
188 changes: 0 additions & 188 deletions client/src/document/code/ai-explain.ts

This file was deleted.

79 changes: 0 additions & 79 deletions client/src/document/code/copy.ts

This file was deleted.

Loading