Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gatsby-remark-autolink-headers

Package Overview
Dependencies
Maintainers
1
Versions
535
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gatsby-remark-autolink-headers - npm Package Compare versions

Comparing version 1.0.0-beta.1 to 1.0.0-beta.6

6

gatsby-browser.js

@@ -6,4 +6,4 @@ "use strict";

setTimeout(function () {
var hash = window.location.hash.replace(`#`, ``);
if (hash !== ``) {
var hash = window.location.hash.replace("#", "");
if (hash !== "") {
var element = document.getElementById(hash);

@@ -25,3 +25,3 @@ if (element) {

// For production, the equivalent code is in gatsby-ssr.js.
if (process.env.NODE_ENV !== `production`) {
if (process.env.NODE_ENV !== "production") {
scrollToHash(offsetY);

@@ -28,0 +28,0 @@ }

@@ -17,47 +17,14 @@ "use strict";

var styles = `
.anchor {
float: left;
padding-right: 4px;
margin-left: -20px;
}
h1 .anchor svg,
h2 .anchor svg,
h3 .anchor svg,
h4 .anchor svg,
h5 .anchor svg,
h6 .anchor svg {
visibility: hidden;
}
h1:hover .anchor svg,
h2:hover .anchor svg,
h3:hover .anchor svg,
h4:hover .anchor svg,
h5:hover .anchor svg,
h6:hover .anchor svg {
visibility: visible;
}
`;
var styles = "\n .anchor {\n float: left;\n padding-right: 4px;\n margin-left: -20px;\n }\n h1 .anchor svg,\n h2 .anchor svg,\n h3 .anchor svg,\n h4 .anchor svg,\n h5 .anchor svg,\n h6 .anchor svg {\n visibility: hidden;\n }\n h1:hover .anchor svg,\n h2:hover .anchor svg,\n h3:hover .anchor svg,\n h4:hover .anchor svg,\n h5:hover .anchor svg,\n h6:hover .anchor svg {\n visibility: visible;\n }\n ";
var script = `
document.addEventListener("DOMContentLoaded", function(event) {
var hash = location.hash.replace('#', '')
if (hash !== '') {
var element = document.getElementById(hash)
if (element) {
var offset = element.offsetTop
// Wait for the browser to finish rendering before scrolling.
setTimeout((function() {
window.scrollTo(0, offset - ${offsetY})
}), 0)
}
}
})
`;
var script = "\n document.addEventListener(\"DOMContentLoaded\", function(event) {\n var hash = location.hash.replace('#', '')\n if (hash !== '') {\n var element = document.getElementById(hash)\n if (element) {\n var offset = element.offsetTop\n // Wait for the browser to finish rendering before scrolling.\n setTimeout((function() {\n window.scrollTo(0, offset - " + offsetY + ")\n }), 0)\n }\n }\n })\n ";
return setHeadComponents([_react2.default.createElement(
"style",
{ type: "text/css" },
{ key: "gatsby-remark-autolink-headers-style", type: "text/css" },
styles
), _react2.default.createElement("script", { dangerouslySetInnerHTML: { __html: script } })]);
), _react2.default.createElement("script", {
key: "gatsby-remark-autolink-headers-script",
dangerouslySetInnerHTML: { __html: script }
})]);
};
"use strict";
var toString = require(`mdast-util-to-string`);
var visit = require(`unist-util-visit`);
var slugs = require(`github-slugger`)();
var toString = require("mdast-util-to-string");
var visit = require("unist-util-visit");
var slugs = require("github-slugger")();

@@ -19,15 +19,15 @@ function patch(context, key, value) {

visit(markdownAST, `heading`, function (node) {
visit(markdownAST, "heading", function (node) {
var id = slugs.slug(toString(node));
var data = patch(node, `data`, {});
var data = patch(node, "data", {});
patch(data, `id`, id);
patch(data, `htmlAttributes`, {});
patch(data, `hProperties`, {});
patch(data.htmlAttributes, `id`, id);
patch(data.hProperties, `id`, id);
patch(data, "id", id);
patch(data, "htmlAttributes", {});
patch(data, "hProperties", {});
patch(data.htmlAttributes, "id", id);
patch(data.hProperties, "id", id);
node.children.unshift({
type: `link`,
url: `#${id}`,
type: "link",
url: "#" + id,
title: null,

@@ -37,8 +37,8 @@ data: {

"aria-hidden": true,
class: `anchor`
class: "anchor"
},
hChildren: [{
type: `raw`,
type: "raw",
// The Octicon link icon.
value: `<svg aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg>`
value: "<svg aria-hidden=\"true\" height=\"16\" version=\"1.1\" viewBox=\"0 0 16 16\" width=\"16\"><path fill-rule=\"evenodd\" d=\"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z\"></path></svg>"
}]

@@ -45,0 +45,0 @@ }

{
"name": "gatsby-remark-autolink-headers",
"description": "Gatsby plugin to autolink headers in markdown processed by Remark",
"version": "1.0.0-beta.1",
"version": "1.0.0-beta.6",
"author": "Kyle Mathews <mathews.kyle@gmail.com>",

@@ -6,0 +6,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc