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.

Markdoc formatter

See original GitHub issue

I need to write a script that modifies Markdoc files. Specifically, it will add an id attribute to nodes that do not yet have one. For example, given the file:

# Debugging

# Running {% #running %}

I want to modify the file to:

# Debugging {% #d3adb33f %}

# Running {% #running %}

(Where d3adb33f is some fresh identifier, e.g. a UUID.)

I want to do this transform with a pipeline like

input --[Markdoc.parse]--> AST -> --[custom logic]--> AST --[Markdown.stringify]--> output

However, I don’t see a Markdoc.stringify, or a Node.toString, or a Markdoc renderer, or anything like that.

Has anyone written a Markdown.stringify or similar? Or could you recommend some other way to achieve my goals?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mfix-stripecommented, Jul 25, 2022

@jameshfisher, no one has written this yet, but it is on our roadmap to do so. I will leave this issue open in case someone takes a stab at writing one 🙂

0reactions
mfix-stripecommented, Sep 19, 2022

Going to close out this issue, with the existence of https://github.com/markdoc/markdoc/blob/main/src/formatter.ts.

If folks run into issues with the formatter (as I am sure there are still bugs), please open a new issue 👍.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Markdoc | A powerful, flexible, Markdown-based authoring ...
Adopt anywhere. Use Markdoc to create interactive documentation experiences, static content sites, authoring tooling, and more.
Read more >
markdoc/markdoc: A powerful, flexible, Markdown ... - GitHub
A powerful, flexible, Markdown-based authoring framework. Markdoc is a Markdown-based syntax and toolchain for creating custom documentation sites and ...
Read more >
How Stripe builds interactive docs with Markdoc
Our custom authoring format, called Markdoc, was designed to decouple code and content while enforcing proper discipline at the boundaries.
Read more >
Markdoc: A Markdown-based document format and framework ...
Markdoc is a Markdown-based document format and a framework for content publishing. It was designed internally at Stripe to meet the needs ...
Read more >
Stripe Releases Markdoc! - Elaniin Blog
Markdoc is a Markdown-based syntax document, toolchain, and framework for ... However, it can be a fully declarative format that can be ...
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