mirror of https://gitlab.com/curben/blog
fix(heading-link): compatibility with marked v15
https://github.com/hexojs/hexo-renderer-marked/pull/305
This commit is contained in:
parent
bd36476125
commit
cc675429b8
|
@ -11,7 +11,7 @@
|
||||||
const { join } = require('path').posix
|
const { join } = require('path').posix
|
||||||
|
|
||||||
hexo.extend.filter.register('marked:renderer', (renderer) => {
|
hexo.extend.filter.register('marked:renderer', (renderer) => {
|
||||||
renderer.image = (href, title, alt) => {
|
renderer.image = ({ href, title, text: alt }) => {
|
||||||
if (!alt) alt = ''
|
if (!alt) alt = ''
|
||||||
if (!title) title = alt
|
if (!title) title = alt
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ const anchorId = (str, transformOption) => {
|
||||||
hexo.extend.filter.register('marked:renderer', function (renderer) {
|
hexo.extend.filter.register('marked:renderer', function (renderer) {
|
||||||
const { config } = this
|
const { config } = this
|
||||||
const headingId = {}
|
const headingId = {}
|
||||||
renderer.heading = function (text, level) {
|
renderer.heading = function ({ text, depth: level }) {
|
||||||
const { modifyAnchors } = config.marked
|
const { modifyAnchors } = config.marked
|
||||||
const transformOption = modifyAnchors
|
const transformOption = modifyAnchors
|
||||||
let id = anchorId(text, transformOption)
|
let id = anchorId(text, transformOption)
|
||||||
|
|
Loading…
Reference in New Issue