Skip to content

Commit

Permalink
Replace useExternalLinkAsNewTab() with remark-external-links (#543)
Browse files Browse the repository at this point in the history
  • Loading branch information
ybiquitous authored Jul 5, 2021
1 parent 4e4e7a3 commit cb934e0
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 17 deletions.
61 changes: 46 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"postcss-loader": "^6.1.0",
"postcss-nesting": "^8.0.1",
"remark-autolink-headings": "^6.0.1",
"remark-external-links": "^8.0.0",
"remark-footnotes": "^3.0.0",
"remark-gfm": "^1.0.0",
"remark-highlight.js": "^6.0.0",
Expand Down
3 changes: 1 addition & 2 deletions src/pages/BlogPost.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useRef, useEffect } from "react";
import { Link } from "../Link";
import { Breadcrumb, Time, useTitle, useExternalLinkAsNewTab } from "../utils";
import { Breadcrumb, Time, useTitle } from "../utils";
import s from "./BlogPost.module.css";

/**
Expand Down Expand Up @@ -36,7 +36,6 @@ const generateTOC = (content, toc) => {
// eslint-disable-next-line max-lines-per-function
export const BlogPost = ({ title, published, lastUpdated, tags, content, prev, next }) => {
useTitle(title, "Blog");
useExternalLinkAsNewTab();

/** @type {React.MutableRefObject<HTMLElement | null>} */
const contentElement = useRef(null);
Expand Down
2 changes: 2 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const HtmlWebpackPlugin = require("html-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
// @ts-expect-error -- TS7016
const remarkAutolinkHeadings = require("remark-autolink-headings");
const remarkExternalLinks = require("remark-external-links");
const remarkFootnotes = require("remark-footnotes");
const remarkGFM = require("remark-gfm");
// @ts-expect-error -- TS7016
Expand Down Expand Up @@ -65,6 +66,7 @@ module.exports = {
remarkGFM,
remarkSlug,
[remarkAutolinkHeadings, { behavior: "append" }],
remarkExternalLinks,
remarkFootnotes,
remarkHighlight,
remarkHTML,
Expand Down

0 comments on commit cb934e0

Please sign in to comment.