fix(heading-link): follow upstream example

https://marked.js.org/using_pro#renderer
This commit is contained in:
Ming Di Leom 2025-01-16 11:19:38 +00:00
parent cc675429b8
commit b75c9eaf91
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
2 changed files with 3 additions and 2 deletions

View File

@ -54,7 +54,7 @@ To use the old login page, mouse-over on the **Account** link at the top right c
3. Mouse-over on the **Account** link at the top right corner and click on **My Orders**. It should redirects to `https://login.aliexpress.com/...`
## "Ignore X-Frame-Options" extension
## 'Ignore X-Frame-Options' extension
[**Ignore X-Frame-Options**](https://addons.mozilla.org/en-US/firefox/addon/ignore-x-frame-options-header/) Firefox extension is a way to whitelist the domain from the restriction. By default, the extension whitelist all domains. This is highly discouraged because it nullifies the security benefits of x-frame-options (e.g. prevent a banking website from being iframe-d inside a phishing website). Instead, we can whitelist the login page only.

View File

@ -15,7 +15,8 @@ const anchorId = (str, transformOption) => {
hexo.extend.filter.register('marked:renderer', function (renderer) {
const { config } = this
const headingId = {}
renderer.heading = function ({ text, depth: level }) {
renderer.heading = function ({ tokens, depth: level }) {
const text = this.parser.parseInline(tokens)
const { modifyAnchors } = config.marked
const transformOption = modifyAnchors
let id = anchorId(text, transformOption)