question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Export compiler function

See original GitHub issue

Initial checklist

Problem

Heya, I would like to directly import/use the compiler, on a pre-created list of events. I think this is currently not possible?

Obviously this is the key function provided by this package, then fromMarkdown is just a wrapper around it and the upstream postprocess/parse/postprocess functions (all importable)

Solution

Allow for e.g.

import {compiler} from 'mdast-util-from-markdown/lib/index'

compiler(options)(events)

I guess this just requires the addition of export function compiler..., and a small modification of package.json, ilke in micromark itself:

{
  "exports": {
    ".": {
      "development": "./dev/index.js",
      "default": "./index.js"
    },
    "./lib/index": {
      "development": "./dev/lib/index.js",
      "default": "./lib/index.js"
    },
    "./lib/index.js": {
      "development": "./dev/lib/index.js",
      "default": "./lib/index.js"
    }
  }
}

Alternatives

Don’t think so

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:30 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
chrisjsewellcommented, Mar 29, 2022

actually one more thing 😅

micromark was in created in part to make CSTs possible, but the tokens are not that.

Out of interest, why would you say tokens are not a CST?

1reaction
chrisjsewellcommented, Mar 29, 2022

events literally contain micromark internals

But then it feels strange that you basically have to use them, to create a micromark plugin. It seems like you are saying that creating a micromark plugin should not be possible, because it kind of only uses private APIs

But anyhow, thanks again for your time! I think I’ve discussed all I can about my use case at this point

Read more comments on GitHub >

github_iconTop Results From Across the Web

/EXPORT (Exports a Function) | Microsoft Learn
The /EXPORT option specifies a function or data item to export from your program so that other programs can call the function or...
Read more >
Externs and Exports | Closure Compiler - Google Developers
Purpose of Exports​​ Exports are another mechanism for giving symbols consistent names after compilation. They are less useful than externs and ...
Read more >
How does a compiler deal with inlined exported functions?
A function is only inline if declared using that keyword or if defined inside the class definition, and inline is only a hint;...
Read more >
#pragma export - IBM
Purpose. Declares that an external function or variable is to be exported. The pragma also specifies the name of the function or variable...
Read more >
export - ARM Compiler armasm User Guide Version 6.5
The EXPORT directive declares a symbol that can be used by the linker to resolve symbol references in separate object and library files....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found