Add support for passing an extra env object to the MarkdownSerializer #99

Closed
segevfiner wants to merge 1 commit from serializer-env into master
segevfiner commented 2023-05-16 14:39:08 +02:00 (Migrated from github.com)

Similar to the env passable to markdown-it parse

Similar to the env passable to markdown-it parse
marijnh commented 2023-05-17 09:57:44 +02:00 (Migrated from github.com)

What is the intended use of this?

Edit: never mind, just saw #98 . Added a comment there.

What is the intended use of this? Edit: never mind, just saw #98 . Added a comment there.
segevfiner commented 2023-05-17 15:16:14 +02:00 (Migrated from github.com)

I don't understand what do you suggest that I do instead...

I don't understand what do you suggest that I do instead...
marijnh commented 2023-05-17 15:21:57 +02:00 (Migrated from github.com)

Something like this (or, more crudely, just set a global):

let env = null
function withEnv(_env, f) {
  let prev = env
  env = _env
  try { return f() }
  finally { env = prev }
}
Something like this (or, more crudely, just set a global): ```javascript let env = null function withEnv(_env, f) { let prev = env env = _env try { return f() } finally { env = prev } } ```
segevfiner commented 2023-05-17 15:44:56 +02:00 (Migrated from github.com)

That doesn't feel like a very safe way of doing it...

That doesn't feel like a very safe way of doing it...

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
prosemirror/prosemirror-markdown!99
No description provided.