You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've selected this as my rustlearn project - I do know several other programming languages, some quite proficient.
I was toying around with this project and copying things into my own project and so on.
Things that I think should be conceptually different:
md2tex should be a relatively dumb markdown to tex converter.
Meaning the following things should be done in mdbook-latex:
conversion of URL's
adjustment of heading levels
copying and converting images
adding all the header and footer latex
any other preprocessing
mdbook-latex should do all the preprocessing and send an Iterator<Event> to md2tex this would remove the parsing and back to string and parsing again from Fix images 2 #10
mdbook-latex should do this for every chapter separately and be responsible for putting the chapters together. That way the heading-levels don't get as messed up as they do now... mentioned in Successful Build of rust-lang/book with xelatex #11
A first level heading inside a .md file should be one level below it's parent chapter level.
As you cannot AFAIK create a Parser from Events and the Parser is more or less just an Iterator. I'd suggest to change the function signatures so that there is a function that takes an Iterator of events and generates the tex code. That way you can still give it a parser, but also a Vec or something similar I moved the parser-creation to a sepparate function for backwards-compatibility (pullrequest: lbeckman314/md2tex/pull/4):
/// Converts markdown string to tex string. (But I'd not use this function in mdbook-latex)pubfnmarkdown_to_tex(markdown:String) -> String{letmut options = Options::all();let parser = Parser::new_ext(&markdown, options);returnparser_to_tex(parser);// optionally this could add a very simple header and footer so that the resulting .tex does compile.}/// Takes a pulldown_cmark::Parser or any iterator containing `pulldown_cmark::Event` and transforms it to a stringpubfn parser_to_tex<'a,P>(parser:P,headingoffset:u32) -> StringwhereP:'a + Iterator<Item = Event<'a>>,{[...]
With these changes I think md2tex would be way more flexible and mdbook-latex would be better at correctness and extendability.
I'm going to do some of it anyways to learn rust - should I send pullrequests? If so do you agree with the changes above? what are your 2¢? - what do you want pullrequests for?
The text was updated successfully, but these errors were encountered:
Hey,
I've selected this as my rustlearn project - I do know several other programming languages, some quite proficient.
I was toying around with this project and copying things into my own project and so on.
Things that I think should be conceptually different:
md2tex
should be a relatively dumb markdown to tex converter.Meaning the following things should be done in mdbook-latex:
mdbook-latex
should do all the preprocessing and send anIterator<Event>
to md2tex this would remove the parsing and back to string and parsing again from Fix images 2 #10mdbook-latex
should do this for every chapter separately and be responsible for putting the chapters together. That way the heading-levels don't get as messed up as they do now... mentioned in Successful Build of rust-lang/book with xelatex #11.md
file should be one level below it's parent chapter level.As you cannot AFAIK create a
Parser
fromEvents
and theParser
is more or less just anIterator
. I'd suggest to change the function signatures so that there is a function that takes an Iterator of events and generates the tex code. That way you can still give it a parser, but also a Vec or something similar I moved the parser-creation to a sepparate function for backwards-compatibility (pullrequest: lbeckman314/md2tex/pull/4):With these changes I think
md2tex
would be way more flexible andmdbook-latex
would be better at correctness and extendability.I'm going to do some of it anyways to learn rust - should I send pullrequests? If so do you agree with the changes above? what are your 2¢? - what do you want pullrequests for?
The text was updated successfully, but these errors were encountered: