-
-
Notifications
You must be signed in to change notification settings - Fork 101
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
Native markdown overhaul #1481
Native markdown overhaul #1481
Conversation
From a real quick glance, it looks like the function we're overriding to hack this in is a publicly exposed one. Can we use lunamark as a regular dependency and just patch that function internally instead of having a vendored copy again? |
We could. I'd want to propose the fixes and improvements I am preparing to lunamark, though, eventually, and see how the owner reacts. Another possibility would be to maintain our own fork of it (outside), if the owner is not interested. |
If we can get away with just monkey patching a function after we load the upstream library lets start with that. Of course proposing the fixes upstream is fine too, but until such a time as they are accepted and released we still need a deploy path that works for us. Forking is a potential if the upstream was really unmaintained, but as long as we can't reasonably be the canonical fork, using a fork is problematic for packaging and distribution. At that point we would have to vendor it like it is now. |
9e6e31c
to
8fc7d4a
Compare
Actually I should have read the comments more thoroughfully, our markdown class stated in its initial comment
So we already had kind of a fork. Oh well, let's proceed anyway, and sort the mess later 🌵 (but this note is added as a reminder) |
Description updated, with a task list for subsequent steps. |
I'll fix the merge conflicts, don't worry about those. |
I just handled the merge conflicts for you. Note that since this brings in the new modular inputter setup in from master, the merge splits up what you had all in the markdown class into two places: a markdown inputter and the markdown class. As you started to setup, using the markdown reader also sets the document class to be markdown by default. We could work on exactly how that works, but for now it seemed like a good place to start. You can call this on a markdown file by requesting the inputer be loaded at run time: $ sile -r inputter.markdown myfile.md The output should go straight to PDF as usual. Don't worry too much about the exact details of your commits if you keep working on this. I see some of these need some refactoring or are even temporary, but I don't mind doing the rebase work to get them cleaned up if needed. |
I handled the merge conflicts locally, but for some reason I can't push them here. I don't think you enabled the "maintainers can push to this branch" option on this PR, perhaps you'd like to. In case not I stuck a copy of the branch with my merges on the end here and you could pull in my changes from there to your local branch. |
I actually just disabled it on all my PRs ^^ As of this one (a draft), the mardown class will probably have to go away at some point, in favor of a package that may be used in any class (not necessarily deriving from the current book class). I am not yet there, though. |
However you like. The merge is pretty involved though so I do suggest you at least merge my PR and then move on from there.
That sounds like a reasonable refactor, and roughly what I already did with the One caveat: we'll probably want a class anyway to trigger the right package(s) to load, but it can be pretty slim and many of the content processing functions can move to a package. I think it would also be possible to setup a class with a classoption that determined the parent: i.e. we could have a markdown class that optionally inherited from plain or book depending on a value passed in with |
dda1c3c
to
6c93cdc
Compare
8119f13
to
4d739be
Compare
N.B.
|
4d739be
to
cbe64e9
Compare
6e56fb2
to
dbc6e55
Compare
dbc6e55
to
eaeabad
Compare
Update:
In the meantime, lunamark has moved merging PR 36, so work can resume after my return from vacations. |
756f2fd
to
104adae
Compare
This helped a lot refactoring the markdown packages and check its commands. Closes sile-typesetter#1493
104adae
to
a154871
Compare
Update:
|
c3c28fa
to
275f376
Compare
Update:
I think this is getting quite close to completion now (note). Besides more test cases, all we now need is the ptable and textsubsuper packages to be available in master (so as to remove the shims here, rebase the PR orderly and do some proper refactor before review). @alerque What do you think would be a decent time-frame for that to occur? (note) There are of course still areas that could be extended, but they'd all require more work on lunamark (e.g. link attributes, line blocks) and/or adequate SILE building-blocks (e.g. external formatters). |
275f376
to
c652ad8
Compare
c652ad8
to
b2329cc
Compare
I am refactoring this as an "external" luarocks package. |
There it goes: https://luarocks.org/modules/Omikhleia/markdown.sile |
Closes #1336
A work-in-progress to at least get the existing "native markdown" route working decently.
First 3 commits are mainly to make it work again...
Rationale: the old version was close to 200 locals in a function, meaning we could hardly modify it... And one bug or two were also fixed apparently)
Rationale: that master version
removeddoes not have theast
writer (from our earlier fork, see note below) and enforces text output. It's a one-liner to fix, and allows us to work with the AST directly again...... and even with a few improvements, e.g.
Subsequent commits are additional features (Pandoc-like extensions) with corresponding changes in lunamark:
~~deleted~~
[text]{.underline}
,[text]{.smallcaps}
[text]{lang=fr}
or as fenced colon block,::: {lang=fr} ...
)![](image.png){ height=..., width=... }
(keys passed through to SILE, so our units work there){=xxx}
after a simple inline code (with backticks) or as infostring on a fenced block code (backticks or tildes), with SILE support for SILE-code and Lua, as{=sile}
,{=sile-lua}
python
, one can use{.python key=value}
)H~2~O
,2^10^
Eventually, when judged stable enough the changes to lunamark shall be proposed to upstream to its repository. UPDATE: PR submitted.
At this points, I am taking a short break. Future tasks ought to be:
labelrefsCross-referencing package #1366 (nope, won't do, see comments)