Skip to content

Commit

Permalink
Merge pull request #129 from pulsar-edit/ensure-pack-is-always-available
Browse files Browse the repository at this point in the history
Ensure `pack` is available within `md.renderer.rules.image`
  • Loading branch information
confused-Techie authored Jan 10, 2024
2 parents 2775170 + 494e155 commit 030335c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ function addCustomMarkdownHandling () {
let defaultImageRender = md.renderer.rules.image;

md.renderer.rules.image = function(tokens, idx, options, env, self) {
// HACK: Get the `pack` object from an outer scope so that we don't have
// to redefine this handler on every request.
let pack = currentPackage;
let token = tokens[idx];
let aIndex = token.attrIndex('src');

Expand Down

0 comments on commit 030335c

Please sign in to comment.