xoofx / xoofx/markdig

Setting ImplicitParagraph has no effect

Open
#385 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

As far as I understand, setting ImplicitParagraph to false should prevent markdig from wrapping rendered HTML in a <p>.

However, the following test does not behave as expected

            var pipeline = new MarkdownPipelineBuilder().Build();
            var writer = new StringWriter();
            var renderer = new Markdig.Renderers.HtmlRenderer(writer);
            renderer.ImplicitParagraph = false;
            pipeline.Setup(renderer);
            var foo = Markdown.ToHtml("test", pipeline);

            // foo is "<p>test</p>\n" and not "test"

Furthermore, this parameter (and the couple more similar) are only interesting at render time and as such, they should be directly settable -- the user should not be forced to go through 5 lines of setup to set a basic option, such as when rendering a snippet. This also makes them basically undiscoverable.

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

Start with the supplied C# reproduction using MarkdownPipelineBuilder, HtmlRenderer, ImplicitParagraph, and Markdown.ToHtml. Trace why setting HtmlRenderer.ImplicitParagraph to false still produces paragraph tags, and review the other render-time options mentioned in the issue. Done means the reproduction omits the wrapping tags and render-time options can be set directly as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.