Comments (8)
You could always nest the section in a div?
from djot.
Yeh, but ughh, I feel that doesn't seem very readable or user friendly
In the example, its not clear why its in a div, and seems more like a "hack" than a feature π€
from djot.
I guess its not the end of the world, if this is the "solution" π¬
But I do feel at least this aspect of the heading parsing should be better documented in https://htmlpreview.github.io/?https://github.com/jgm/djot/blob/master/doc/syntax.html#heading
I guess the logic is that headings add sections if they are a child of the doc
or another section
?
from djot.
I guess the logic is that headings add sections if they are a child of the doc or another section?
Yes. Agreed that the "section" behavior should be documented.
As for ugliness, I think it's no more ugly that {section=false}
(though perhaps less explicit as to its purpose, at least for people who know English).
What's the real-world case that is motivating this?
from djot.
Yes. Agreed that the "section" behavior should be documented.
π
As for ugliness, I think it's no more ugly that {section=false} (though perhaps less explicit as to its purpose, at least for people who know English).
No you are right actually, I should of never doubted you π
But yes documenting the section behaviour woulf be great thanks π
from djot.
It's perhaps not only a documentation issue. To me, it might also lead to inconsistencies in interpretation, as attributes and ids are on the section node when present, not the header:
{ .red }
# Chap1
Lorem
{ .twocolumn }
:::
{ .blue }
# Chap2
Ipsum
:::
doc
section class="red" id="Chap1"
heading level=1
str text="Chap1"
para
str text="Lorem"
div class="twocolumn"
heading level=1 class="blue" id="Chap2"
str text="Chap2"
para
str text="Ipsum"
Which content is supposed to be "red", and "blue" ? The whole section (including all child nodes) or just the header?
Where are links supposed to be applied (e.g. if chapters introduced a page break to start on an odd page in print), where the section starts or where the actual header ends up?
Is the expected sectioning really respected in the above?
EDIT:
as attributes and ids are on the section node when present, not the header:
BTW if I am not mistaken, djot.lua (at least at one point) differs from djot.js / the online playground here - having the id on the section node, but not the other attributes.
from djot.
This would be less confusing if there were just one AST element, Section, with a field for a title. Of course, this would be rendered in HTML as a <hN>
element embedded in a <section>
. But then, it would be clearer conceptually why all the attributes go on the section, and it is impossible to put them on the heading.
Which content is supposed to be "red", and "blue" ? The whole section (including all child nodes) or just the header?
In HTML output at least, you can choose by using appropriate CSS rules.
from djot.
Sorry in case this is not entirely the right place for this question, but I found this issue trying to figure out the intended behavior of block attributes added to headings. Now, the last comment says (emphasis mine):
But then, it would be clearer conceptually why all the attributes go on the section, and it is impossible to put them on the heading.
This seems to be the answer I was looking for, but I initially played with the playground, and was a little surprised by this example:
doc
section
heading level=1 foo="bar"
str text="heading"
para
str text="text"
Somewhat unexpectedly, all attributes are assigned to the section instead if, and only if, one of them is an id.
Is that an implementation issue? Is it possible to describe the intended behavior in a sentence or two? I am not so much interested in the workarounds, but curious about the consistency here, like "if a heading generates a section, all attributes should be assigned to the section"? Thanks for Djot btw, and thanks in advance for any guidance π
from djot.
Related Issues (20)
- Tables with a column of th elements HOT 1
- Typo in syntax.md
- Proposal: Punctuation Character for Code Block's language specifier HOT 6
- Playground: slow on Safari HOT 5
- Supporting βcommandsβ in addition to βclassesβ in attributes? HOT 2
- Hard-wrapping: require subsequent lines to be indented/quoted? HOT 6
- Two asterisks for βstrongβ? HOT 3
- Inline footnotes?
- Support `<dfn>`, `<cite>` and `<i>`? HOT 2
- Parsing inconsistency: lazy paragraph lines in lists HOT 4
- The closing delimiter of a div block can interrupt a paragraph HOT 4
- Should block attributes mark a div block delimiter as opening? HOT 1
- section nesting for non-consecutive heading levels HOT 1
- [Proposal] more permissive definition of allowed symbol syntax HOT 43
- [Proposal] Remove leading whitespace HOT 2
- Allow any valid HTML4 identifier string to be a djot identifier string HOT 2
- Allow underscore in task list to denote unchecked item HOT 2
- loose list appears unexpectedly when using tight lists HOT 4
- Use `![alt](path)` syntax not only to include images, but also text files HOT 9
- The definition item in a descrition list is always a paragraph HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from djot.