Giter VIP home page Giter VIP logo

Comments (4)

kjk avatar kjk commented on June 26, 2024

Please create and link to a fully runnable example e.g. on https://onlinetool.io/goplayground/

Also provide more context about what you expect and why.

Just looking at the code:

  • why ls.Tight = true
  • either list() isn't executed at all or the result snippet isn't the one generated by the code

from markdown.

Lord-Y avatar Lord-Y commented on June 26, 2024

@kjk Here is the example: https://onlinetool.io/goplayground/#avoxF4PMHIf
This is what I expect:

<p class="my-4">Asterisks loose:</p>
<ul class="list-inside list-disc marker:text-emerald-500">
<li>asterisk 1</li>
<li>asterisk 2</li>
<li>asterisk 3</li>
</ul>

from markdown.

kjk avatar kjk commented on June 26, 2024

The problem is in your paragraph() renderer.

See https://github.com/gomarkdown/markdown/blob/master/html/renderer.go#L596C2-L606C2

There's logic to skip <p> inside in <li> in SkipParagraphTags() function.

You must do:

func paragraph(w io.Writer, x *ast.Paragraph, entering bool) {
	if html.SkipParagraphTags(x) {
		return
	}
    if entering {
		io.WriteString(w, `<p class="my-4">`)
	} else {
		io.WriteString(w, "</p>")
	}
}

See fixed example: https://onlinetool.io/goplayground/#C8hhoeyINje

from markdown.

Lord-Y avatar Lord-Y commented on June 26, 2024

Thx for the help 💯 .

from markdown.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.