xoofx / xoofx/markdig

Feature wishlist

Open
#362 3 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C#
Stars
5.3k
Forks
510
Avg merge
8d 5h
Merged PRs (30d)
5

Description

Hi all! I'm developing a library where standardized extensions can be written. The idea is to enable easy development of block and inline elements, which themselves have an internal syntax. I have built a layer on top of Markdig. In developing this library (which I will make available once I'm satisfied and licensing issues are fixed), I stumbled upon some things that I'd like to mention/discuss. These are:

  1. immutable AST
  2. easy AST creation
  3. Renderers with DI injected dependencies
  4. AST Transformers
  5. JS/CSS embedding

Details:

  1. Immutable AST
    While having a mutable AST is nice for performance, an immutable one is beneficial in preventing mistakes and gaining larger-sclae performance (multi-threading, async, reusability of AST parts)
  2. Easy AST creation
    This one is nice for testing and nice for "AST renderers". Some of my extensions don't render html but render markdown instead. This way normalized markdown rendering still works, and target html can reuse styling of the overall document stylesheet. In order to implement AST renderers, it's nice to provide a direct AST instead of a markdown string which is then parsed. It's faster, less error-prone and also typed.
  3. Some renderers/transformers for certain extensions I created need data from outside sources (i.e. database). Current implementations simply get these dependencies injected. This works, but adding extensions to the pipeline involves creating the extension instances. Passing a Func to AddIfNotAlready() would help here.
  4. When having an immutable AST, we can build AST transformers. They take an AST and produce a new AST where items from the input AST are reused in the output AST. This is fast and memory efficient.
  5. In my library, I have a way for extensions to provide javascript and css. For example, I have an extension which produces a BPMN 2.0 graph using the excellens bpmn-js lib. For this to work, I inject js+css in the rendered html document. While it's not hard to do so, and maybe out-of-place in the library like Markdig, it may be worth tinkering about.

I want to express my gratitude for publishing Markdig. This post is meant to take the existing solution and ponder about ways to move it forward.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue is a broad wishlist covering immutable ASTs, AST creation, dependency injection, transformers, and JavaScript/CSS embedding, but it names no files, tests, or entry points. Start by reviewing Markdig's existing AST and extension pipeline, then narrow the discussion to one proposal with explicit scope and acceptance criteria; the issue currently does not define a concrete done state.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
15/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.