-
Notifications
You must be signed in to change notification settings - Fork 3
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
Add title to footer #11
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR.
There is one issue with extracting the title for adoc files. Otherwise this is good.
H.extract_title = function(slide) | ||
local title = "" | ||
for _, line in pairs(vim.split(slide, "\n")) do | ||
-- if line is nonempty set it as title | ||
if line:match("%S") then | ||
title = line | ||
break | ||
end | ||
end | ||
-- strip any trailing whitespace | ||
title = title:gsub("%s+$", "") | ||
-- strip any starting * or # for org and md | ||
title = title:gsub("^%*+%s*", "") | ||
title = title:gsub("^#+%s*", "") | ||
return title | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Glad to hear that presenting.nvim
works for you ❤️
Having a frontmatter parer would be nice, but I want to keep presenting.nvim
as simple as possible and don't want any external deps.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can do it in plain Lua, e.g. if the first line in the first slide starts with title:
then we parse the title etc. This is just to populate the footer of course.
A bit hacky but extracts the title from the first line of the first slide.
It also left aligns the title and right aligns the slide nr.