Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add .nobreak pseudo-class on span/inline elements #65

Merged
merged 1 commit into from
May 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/sile-and-djot.dj
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,11 @@ pseudo-class.

#### Smarter typography

The `.decimal` pseudo-class attribute instructs the converter to consider numbers
On inline content, the `.decimal` pseudo-class attribute instructs the converter to consider numbers
in the content as decimal numbers, formatted with suitable decimal mark and digit grouping according
to the usage in the current language.
This allows, say, 1984 to be rendered as "[1984]{ .decimal } years ago" in English,
or "[1984 années]{ .decimal lang=fr }" in French, with appropriate separators.

The `.nobreak` pseudo-class attribute on inline content ensures that line-breaking will not be applied
there. Use it wisely around small pieces of text or you might end up with more serious justificatin issues! Yet, it might be useful for proper names, etc.
2 changes: 2 additions & 0 deletions examples/sile-and-markdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,8 @@ to the usage in the current language.
This allows, say, 1984 to be rendered as "[1984]{ .decimal } years ago" in English,
or "[1984 années]{ .decimal lang=fr }" in French, with appropriate separators.

Another pseudo-class `.nobreak` is supported on "span" elements. It ensures the content will not be line-broken. Use it wisely around small pieces of text or you might end up with more serious justificatin issues! Yet, it might be useful for proper names, etc.

When smart typography is enabled, the native converter also supports automatically converting
straight single and double quotes after digits to single and double primes.
It can be useful for easily typesetting units (e.g. 6")
Expand Down
4 changes: 3 additions & 1 deletion packages/markdown/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -399,9 +399,11 @@ Please consider using a resilient-compatible class!]])
cascade:call("underline")
end
if options["custom-style"] then
-- The style (or the hook) is reponsible for paragraphing
cascade:call("markdown:custom-style:hook", { name = options["custom-style"], scope = "inline" })
end
if hasClass(options, "nobreak") then
cascade:call("hbox")
end
cascade:process(content)
end, "Span in Markdown (internal)")

Expand Down