gatsby-source-notion-database
Advanced tools
Comparing version 0.6.3 to 0.6.4
{ | ||
"name": "gatsby-source-notion-database", | ||
"version": "0.6.3", | ||
"version": "0.6.4", | ||
"description": "Load data from Notion's database", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -20,3 +20,3 @@ const puppeteer = require('puppeteer'); | ||
}) | ||
// TOC 链接转化 | ||
@@ -40,9 +40,19 @@ let qs = "#notion-app > div > div.notion-cursor-listener > div > div.notion-scroller.vertical.horizontal > div.notion-page-content > div > div:nth-child(1) > div > a" | ||
} | ||
let hashBlockID = getFullBlockId(item.hash.slice(1)) | ||
item.href = `#${hashBlockID}` | ||
let block = document.querySelector(`div[data-block-id="${hashBlockID}"]`) | ||
if (block) { | ||
block.id = hashBlockID | ||
let u | ||
try { | ||
u = new URL(item.href) | ||
} catch (error) { | ||
console.log(error) | ||
} | ||
if (u && u.host === 'www.notion.so') { | ||
let hashBlockID = getFullBlockId(item.hash.slice(1)) | ||
item.href = `#${hashBlockID}` | ||
let block = document.querySelector(`div[data-block-id="${hashBlockID}"]`) | ||
if (block) { | ||
block.id = hashBlockID | ||
} | ||
} | ||
}); | ||
@@ -49,0 +59,0 @@ |
12261
225