-
Notifications
You must be signed in to change notification settings - Fork 31
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
Jekyll header as requested by #22 #77
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.
@TeXhackse Thank you for your work! I have added a review with some notes for future work. Generally, I am willing to accept the PR after we've added support for at least continued lines, sequences and mappings. The goal is not to implement the entire YAML spec, but at least to be compatible with what Pandoc can parse.
thanks, this helps a lot! I will take care of this and continue :) |
Please, do let me know if I can help in some way. |
@Witiko Thanks, I'd do so. sadly had to struggle with some health issues, but getting better, already started with some things. Only thing I am not quite sure how to resolve is how to only allow the Renderer to be applied to the begin of the Markdown input. If you got a hint on that it might be helpful, otherwise I finish the other parts first. |
I would put the corresponding parser at the beginning of what the Line 16730 in 5b1625f
This way, the Jekyll header parser can only be entered at the beginning of a Markdown document. |
ah thanks :) |
There is one additional piece to the puzzle: Although it is possible that blockquotes, footnotes, and definition list items can be described by a PEG grammar, we cheat a little and we parse them recursively using the Line 16988 in c319b6b
|
99f7070
to
3f3a76a
Compare
@Witiko I tried to return to my piece of this (sorry, my health is staying unstable… ), But I don't completly understand your last comment. Is there a way to explain it differently? I'd really love to finish that one. |
Some parts of markdown are parsed recursively (such as blockquotes) rather than as part of a PE grammar. That is what I described as cheating. Interestingly, it's unknown whether there exists a PE grammar for markdown without cheating. That is also why there are implementations and natural language specifications for markdown but no formal grammar specifications: markdown is notoriously difficult to parse. Therefore, unless we want to allow Jekyll front matter at the beginning of blockquotes and other elements, we will need to disable it in the recursive invocations, as described in #77 (comment). |
Alright, I added that adjustment, and tested on current state of rebase on main. So… as far as my understanding works this should be resolved … But please let me know if there are some other secrets which I did not yet understand. |
Oh cool :) concerning the hooks. I will try to find some time during the weekend to have a look at, but probably not before sunday, has been a hard week. |
@krono Customization is expected. The users can freely alter the definition of the |
I understand that; however, the markdown docu is already quite extensive (and also very detailed and good at that!), and the customization feels like one step beond the normal user. So something like this would be helpful:
:) |
@krono In the original implementation, @TeXhackse had a boolean key called |
That sounds very interesting! \markdownSetup{
jekyllDataAutoMaketitle = true, % or false...
} or something… |
@krono The LaTeX person can arbitrarily change the key-values and therefore disable the
At the moment, you would do the following: |
[…]
Yes; but see below.
exactly :)
I understand that. What I mean, that not every markdown-LaTeX user might want to understand the ramification of the On the otherhand, it would be confusing, if you had \markdownSetup {
renderers = { jekyllDataEnd = {} },
jekyllDataAutoMaketitle = true
} people might expect the |
@krono Here is my take: If the user includes YAML metadata, they expect something to happen. At the moment, the package assumes that in 90% cases, that something will be the typesetting of the metadata on the title page. Of course, the defaults will never please everybody, so the remaining 10% can either reach for Markdown themes (if they don't want to program) or they can redefine the default renderers.
The Markdown options are quite low-level and typically map either to the Lua options (enabling different syntax extensions), or to the token renderers (changing how things look). In contrast, options such as |
Ok, that makes sense… |
@TeXhackse Realistically, we may need to stay compatible with at least TeX Live 2020 to support Overleaf. \@ifl@t@r
\fmtversion
{ 2020-10-01 }
{ \AddToHook{begindocument/end}{\maketitle} }
{
\ifx\@onlypreamble\@notprerr
% We are in the document
\maketitle
\else
% We are in the preamble
\RequirePackage{etoolbox}
\AfterEndPreamble{\maketitle}
\fi
} |
We have fixed api7/lua-tinyyaml#10 in api7/lua-tinyyaml#11 and are waiting for the merge. |
443492c
to
337ad3f
Compare
337ad3f
to
d597d9c
Compare
@TeXhackse Congratulations, what a journey! |
@Witiko Thank you a lot. And I am sorry I could not do as much as I would have liked to. |
It's ok, you did lots: the package is 20k lines of not-exactly-contributor-friendly code. Thank you and @krono for kickstarting this feature. I learned a little LaTeX3 along the way, contributed to api7/lua-tinyyaml, and we have a first-ever YAML (subset) parser for TeX as a result. Not bad! |
Since I currently don't have that much free time I just cleaned it up a bit but it still lacks some adjustments.
First of all I currently cannot get it working directly from the LaTeX compiler but only via the cli-mode. I will have a look at this after finishing todays work.
Beside this it currently needs a blank line before the jekyll block, which should also be adjusted. Maybe it's even usefull to only allow it at the beginning of the a markdown block. Since you are more familiar with the package structure feel free to adjust. Otherwise I will do my best to continue with thsi.