Code Monkey home page Code Monkey logo

Comments (3)

jgm avatar jgm commented on September 20, 2024 2

Also, you're right that I don't want to make djot HTML-centric.

from djot.

jgm avatar jgm commented on September 20, 2024

This syntax is already fine; you can put a single word after ::: and it will be interpreted as a class.
https://djot.net/playground/syntax.html#div

Some small modifications to djot's HTML writer would allow Divs with the 'figure' class to render as figures. But I don't think it's something I'd want to make the default.

  local renderer = html.Renderer:new()
  renderer:div = function(node)
    if node.attr and node.attr.class == "figure" then
      self:render_tag("figure", node)
      self.out("\n")
      self:render_children(node)
      self.out("</figure>\n")
    else
      self:render_tag("div", node)
      self.out("\n")
      self:render_children(node)
      self.out("</div>\n")
    end
  end

That said, I think that having a dedicated syntax for figures would be a good thing. I'd like to avoid using English language keywords, though.

from djot.

waldyrious avatar waldyrious commented on September 20, 2024

For what it's worth, I interpret goal 11 as suggesting that there shouldn't be two ways to specify a class for a div, especially when the more explicit one is a single character longer.

Requiring ::: .foobar instead of ::: foobar would make this more consistent with other elements (as pointed out by @adiabatic) and would avoid the "magicness" of a bare word being interpreted as a class attribute (which, incidentally, is a HTML-centric default).

from djot.

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.