@BP i downloaded your file and using it but its still giving this error your can check pandoc -o Functional_Programming_in_C__Second_Edition.epub Functional_Programming_in_C__Second_Edition.md --lua-filter=raw2code.lua [WARNING] Could not convert TeX math "Entering {op}"); ┬á ┬á ┬á T t = f(); ┬á ┬á ┬á log.LogTrace(, rendering as TeX: "Entering {op}"); ┬á ┬á ┬á T t = f(); ┬á ┬á ┬á ^ unexpected '"' expecting "%", "\\label", "\\tag", "\\nonumber", whitespace, "\\bangle", "\\brace", "\\brack", "\\choose", "\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle", "{", "\\operatorname", letter, digit, ".", "!", "'", "''", "'''", "''''", "*", "+", ",", "-", ".", "/", ":", ":=", ";", "<", "=", ">", "?", "@", "~", "_", "^", "\\left", "\\", "\\hyperref" or end of input [WARNING] Could not convert TeX math "{s} should be lower case"); Validator ShouldBeOfLength(int n) ┬á => s => (s.Length == n) ┬á ┬á ┬á ? Valid(s) ┬á ┬á ┬á : Error(, rendering as TeX: "{s} should be lower case"); Validator", "?", "@", "~", "_", "^", "\\left", "\\", "\\hyperref" or end of input [WARNING] Could not convert TeX math "{name} -> {t}"), ┬á ┬á ┬á onError: ex => WriteLine(, rendering as TeX: "{name} -> {t}"), ┬á ┬á ┬á onError: ex => W ^ unexpected '"' expecting "%", "\\label", "\\tag", "\\nonumber", whitespace, "\\bangle", "\\brace", "\\brack", "\\choose", "\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle", "{", "\\operatorname", letter, digit, ".", "!", "'", "''", "'''", "''''", "*", "+", ",", "-", ".", "/", ":", ":=", ";", "<", "=", ">", "?", "@", "~", "_", "^", "\\left", "\\", "\\hyperref" or end of input [WARNING] Could not convert TeX math "Received '{msg}'; Sending 'PING'"); ┬á Task.Delay(500).Wait(); ┬á pong.Tell("PING"); }); pong = Agent.Start(0, (int count, string msg) => { ┬á int newCount = count + 1; ┬á string nextMsg = (newCount < 5) ? "PONG" : "STOP"; ┬á logger.Tell(, rendering as TeX: "Received '{msg}'; Sending 'PING'"); ┬á T ^ unexpected '"' expecting "%", "\\label", "\\tag", "\\nonumber", whitespace, "\\bangle", "\\brace", "\\brack", "\\choose", "\\displaystyle", "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle", "{", "\\operatorname", letter, digit, ".", "!", "'", "''", "'''", "''''", "*", "+", ",", "-", ".", "/", ":", ":=", ";", "<", "=", ">", "?", "@", "~", "_", "^", "\\left", "\\", "\\hyperref" or end of input [WARNING] This document format requires a nonempty element. Defaulting to 'Functional_Programming_in_C__Second_Edition' as the title. To specify a title, use 'title' in metadata or --metadata title="...". PS C:\Users\Hp\Downloads\Compressed> On Saturday, February 12, 2022 at 9:54:25 PM UTC+5 BP wrote: > That's very strange because there doesn't seem to be any `end` missing. > Perhaps there was some error copy-pasting the code out of your mail client. > I have attached the filter as a file. Please try with that. > > Den lör 12 feb. 2022 13:53mr vicky <v.lon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev: > >> >> @BP >> i tried with your method and save your given code as lua file and point >> out that file in command line but its giving me this error >> >> Error running filter raw2code2.lua: >> raw2code2.lua:13: 'end' expected (to close 'if' at line 12) near <eof> >> PS C:\Users\Hp\Downloads\Compressed> >> On Saturday, February 12, 2022 at 4:49:00 PM UTC+5 BP wrote: >> >>> So you are using TeX math? I'm not sure what is going on. Maybe if you >>> post a minimal working example someone knows. >>> >>> Den lör 12 feb. 2022 12:09mr vicky <v.lon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev: >>> >>>> @BP >>>> so i have to create .lua file with this code and point out lua file in >>>> command line ? >>>> by the way i used --webtex in command and its convert epub without any >>>> error but i dont know for what purpose pandoc using --webtex command >>>> may be it is ignoring those type characters or may be i am wrong about >>>> that >>>> >>>> On Saturday, February 12, 2022 at 3:27:48 PM UTC+5 BP wrote: >>>> >>>>> This is probably because Pandoc expects text between dollar signs >>>>> `$...$` and >>>>> `$$...$$` to be TeX math and fails to interpret some text which ended >>>>> up >>>>> between two dollar signs as such. >>>>> >>>>> <https://pandoc.org/MANUAL.html#extension-tex_math_dollars> >>>>> >>>>> Alternatively it may be that pandoc expects text between backslash >>>>> escaped >>>>> parentheses `\(...\)`/`\\(...\\)` or square brackets >>>>> `\[...\]`/`\\[...\']` to be >>>>> TeX math, but I believe those extensions are not enabled by default. >>>>> >>>>> <https://pandoc.org/MANUAL.html#extension-tex_math_single_backslash> >>>>> >>>>> <https://pandoc.org/MANUAL.html#extension-tex_math_double_backslash> >>>>> >>>>> In this case the solution, unless you intended to include TeX math >>>>> somewhere >>>>> in your document, is to disable those extensions by including >>>>> >>>>> -f >>>>> markdown-tex_math_dollars-tex_math_single_backslash-tex_math_double_backslash >>>>> >>>>> in your pandoc command line, or modifying any existing --from, -f, >>>>> --read or -r option accordingly. >>>>> >>>>> Yet another alternative may be that you have TeX code in your document >>>>> which >>>>> needs to be marked as code. For that a slightly modified filter >>>>> provides a >>>>> solution: >>>>> >>>>> local format2class = { >>>>> html = 'html', >>>>> tex = 'latex', >>>>> latex = 'latex' >>>>> } >>>>> local code_for = { >>>>> RawInline = pandoc.Code, >>>>> RawBlock = pandoc.CodeBlock >>>>> } >>>>> local function raw2code (elem) >>>>> local class = format2class[elem.format] >>>>> if class then >>>>> return code_for[elem.tag](elem.text, { class = class }) >>>>> end >>>>> return nil >>>>> end >>>>> return { >>>>> { >>>>> RawInline = raw2code, >>>>> RawBlock = raw2code >>>>> } >>>>> } >>>>> >>>>> Den lör 12 feb. 2022 07:54mr vicky <v.lon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> skrev: >>>>> >>>>>> @BP >>>>>> i am getting this error but its giving only in this book not in other >>>>>> book evan i am using your raw2code.lua file in my command and its working >>>>>> fine in other book but in this book still getting some tags error >>>>>> here you can check >>>>>> >>>>>> pandoc -o Functional_Programming_in_C__Second_Edition.epub >>>>>> Functional_Programming_in_C__Second_Edition.md --lua-filter=raw2code.lua >>>>>> [WARNING] Could not convert TeX math "Entering {op}"); ┬á ┬á ┬á T t = >>>>>> f(); ┬á ┬á ┬á log.LogTrace(, rendering as TeX: >>>>>> "Entering {op}"); ┬á ┬á ┬á T t = f(); ┬á ┬á ┬á >>>>>> ^ >>>>>> unexpected '"' >>>>>> expecting "%", "\\label", "\\tag", "\\nonumber", whitespace, >>>>>> "\\bangle", "\\brace", "\\brack", "\\choose", "\\displaystyle", >>>>>> "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle", "{", >>>>>> "\\operatorname", letter, digit, ".", "!", "'", "''", "'''", "''''", "*", >>>>>> "+", ",", "-", ".", "/", ":", ":=", ";", "<", "=", ">", "?", "@", "~", "_", >>>>>> "^", "\\left", "\\", "\\hyperref" or end of input >>>>>> [WARNING] Could not convert TeX math "{s} should be lower case"); >>>>>> Validator<string> ShouldBeOfLength(int n) ┬á => s => (s.Length == n) ┬á ┬á >>>>>> ┬á ? Valid(s) ┬á ┬á ┬á : Error(, rendering as TeX: >>>>>> "{s} should be lower case"); Validator<s >>>>>> ^ >>>>>> unexpected '"' >>>>>> expecting "%", "\\label", "\\tag", "\\nonumber", whitespace, >>>>>> "\\bangle", "\\brace", "\\brack", "\\choose", "\\displaystyle", >>>>>> "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle", "{", >>>>>> "\\operatorname", letter, digit, ".", "!", "'", "''", "'''", "''''", "*", >>>>>> "+", ",", "-", ".", "/", ":", ":=", ";", "<", "=", ">", "?", "@", "~", "_", >>>>>> "^", "\\left", "\\", "\\hyperref" or end of input >>>>>> [WARNING] Could not convert TeX math "{name} -> {t}"), ┬á ┬á ┬á >>>>>> onError: ex => WriteLine(, rendering as TeX: >>>>>> "{name} -> {t}"), ┬á ┬á ┬á onError: ex => W >>>>>> ^ >>>>>> unexpected '"' >>>>>> expecting "%", "\\label", "\\tag", "\\nonumber", whitespace, >>>>>> "\\bangle", "\\brace", "\\brack", "\\choose", "\\displaystyle", >>>>>> "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle", "{", >>>>>> "\\operatorname", letter, digit, ".", "!", "'", "''", "'''", "''''", "*", >>>>>> "+", ",", "-", ".", "/", ":", ":=", ";", "<", "=", ">", "?", "@", "~", "_", >>>>>> "^", "\\left", "\\", "\\hyperref" or end of input >>>>>> [WARNING] Could not convert TeX math "Received '{msg}'; Sending >>>>>> 'PING'"); ┬á Task.Delay(500).Wait(); ┬á pong.Tell("PING"); }); pong = >>>>>> Agent.Start(0, (int count, string msg) => { ┬á int newCount = count + 1; ┬á >>>>>> string nextMsg = (newCount < 5) ? "PONG" : "STOP"; ┬á logger.Tell(, >>>>>> rendering as TeX: >>>>>> "Received '{msg}'; Sending 'PING'"); ┬á T >>>>>> ^ >>>>>> unexpected '"' >>>>>> expecting "%", "\\label", "\\tag", "\\nonumber", whitespace, >>>>>> "\\bangle", "\\brace", "\\brack", "\\choose", "\\displaystyle", >>>>>> "\\textstyle", "\\scriptstyle", "\\scriptscriptstyle", "{", >>>>>> "\\operatorname", letter, digit, ".", "!", "'", "''", "'''", "''''", "*", >>>>>> "+", ",", "-", ".", "/", ":", ":=", ";", "<", "=", ">", "?", "@", "~", "_", >>>>>> "^", "\\left", "\\", "\\hyperref" or end of input >>>>>> [WARNING] This document format requires a nonempty <title> element. >>>>>> Defaulting to 'Functional_Programming_in_C__Second_Edition' as the >>>>>> title. >>>>>> To specify a title, use 'title' in metadata or --metadata >>>>>> title="...". >>>>>> PS C:\Users\Hp\Downloads\Compressed >>>>>> >>>>>> On Friday, February 11, 2022 at 1:06:13 AM UTC+5 BP wrote: >>>>>> >>>>>>> This filter will convert all raw HTML to code in backticks, with >>>>>>> syntax highlighting. Save it as raw2code.lua and include >>>>>>> --lua-filter=raw2code.lua on the pandoc command line. >>>>>>> >>>>>>> local code_for = { >>>>>>> RawInline = pandoc.Code, >>>>>>> RawBlock = pandoc.CodeBlock >>>>>>> } >>>>>>> local function raw2code (elem) >>>>>>> if 'html' == elem.format then >>>>>>> return code_for[elem.tag](elem.text, { class = 'html' }) >>>>>>> end >>>>>>> return nil >>>>>>> end >>>>>>> return { >>>>>>> { >>>>>>> RawInline = raw2code, >>>>>>> RawBlock = raw2code >>>>>>> } >>>>>>> } >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> Den tors 10 feb. 2022 14:24William Lupton < >>>>>>> wlu...-QSt+ys/nuMyEUIsrzH9SikB+6BGkLq7r@public.gmane.org> skrev: >>>>>>> >>>>>>>> If you simply want to ignore all raw HTML elements then I think >>>>>>>> that a lua filter that ignores all RawInlines (perhaps only those with >>>>>>>> format="html") will work for you. But if some HTML elements need to retain >>>>>>>> their HTML meaning then more logic will be needed. For example, this >>>>>>>> document: >>>>>>>> >>>>>>>> % cat raw.md >>>>>>>> This is <b>bold</b> text. >>>>>>>> >>>>>>>> gives this HTML: >>>>>>>> >>>>>>>> % pandoc raw.md >>>>>>>> <p>This is <b>bold</b> text.</p> >>>>>>>> >>>>>>>> ...but with this filter: >>>>>>>> >>>>>>>> % cat raw.lua >>>>>>>> function RawInline(raw) >>>>>>>> if (raw.format == 'html') then >>>>>>>> return {} >>>>>>>> end >>>>>>>> end >>>>>>>> >>>>>>>> ...it gives this: >>>>>>>> >>>>>>>> % pandoc raw.md -L raw.lua >>>>>>>> <p>This is bold text.</p> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> On Thu, 10 Feb 2022 at 12:49, mr vicky <v.lon...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >>>>>>>> >>>>>>>>> so before convert to epub file i have to edit md file and find all >>>>>>>>> tags and add these backticks ? >>>>>>>>> there is no option in pandoc to ignore tags inside book ? >>>>>>>>> >>>>>>>>> On Thursday, February 10, 2022 at 5:37:27 PM UTC+5 Joost wrote: >>>>>>>>> >>>>>>>>>> On Thu, 10 Feb 2022, at 11:27, mr vicky wrote: >>>>>>>>>> > hello >>>>>>>>>> > i am converting md to epub file but that md file is programming >>>>>>>>>> book >>>>>>>>>> > where is some codes written inside but when i convert it to >>>>>>>>>> epub then >>>>>>>>>> > its auto detecting these tags and making very bad epub file >>>>>>>>>> with page >>>>>>>>>> > breaks and some other kind of coding elements >>>>>>>>>> [...] >>>>>>>>>> > there is any option to ignore programming codes while >>>>>>>>>> converting to epub file ? >>>>>>>>>> >>>>>>>>>> Note that Markdown allows you to include HTML elements, so >>>>>>>>>> whenever you write e.g. <h1> directly, Pandoc assums that's what you're >>>>>>>>>> doing and will put an <h1> tag in the html (or epub) output. >>>>>>>>>> >>>>>>>>>> You'll want to mark the tags as code, which you can do with >>>>>>>>>> backticks: `<h1>`. >>>>>>>>>> >>>>>>>>>> HTH >>>>>>>>>> >>>>>>>>>> -- >>>>>>>>>> Joost Kremers >>>>>>>>>> Life has its moments >>>>>>>>>> >>>>>>>>> -- >>>>>>>>> You received this message because you are subscribed to the Google >>>>>>>>> Groups "pandoc-discuss" group. >>>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>>> send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>>>>>>> To view this discussion on the web visit >>>>>>>>> https://groups.google.com/d/msgid/pandoc-discuss/3806ef68-3553-4e8e-8b04-bf7cc4226e7cn%40googlegroups.com >>>>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/3806ef68-3553-4e8e-8b04-bf7cc4226e7cn%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>>>>> . >>>>>>>>> >>>>>>>> -- >>>>>>>> You received this message because you are subscribed to the Google >>>>>>>> Groups "pandoc-discuss" group. >>>>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>>>> send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>>>>>> >>>>>>> To view this discussion on the web visit >>>>>>>> https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjC3As4wO0e4uz6PtVzakK7jaC89rUKKb_BiUwHpbh%3D7Q%40mail.gmail.com >>>>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/CAEe_xxjC3As4wO0e4uz6PtVzakK7jaC89rUKKb_BiUwHpbh%3D7Q%40mail.gmail.com?utm_medium=email&utm_source=footer> >>>>>>>> . >>>>>>>> >>>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups "pandoc-discuss" group. >>>>>> To unsubscribe from this group and stop receiving emails from it, >>>>>> send an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>>>> >>>>> To view this discussion on the web visit >>>>>> https://groups.google.com/d/msgid/pandoc-discuss/ce37255c-e07f-4f47-958c-81069eb0b870n%40googlegroups.com >>>>>> <https://groups.google.com/d/msgid/pandoc-discuss/ce37255c-e07f-4f47-958c-81069eb0b870n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>>>> . >>>>>> >>>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "pandoc-discuss" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >>>> >>> To view this discussion on the web visit >>>> https://groups.google.com/d/msgid/pandoc-discuss/2c88932a-2358-4cbb-af16-aa6a4dc025c3n%40googlegroups.com >>>> <https://groups.google.com/d/msgid/pandoc-discuss/2c88932a-2358-4cbb-af16-aa6a4dc025c3n%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "pandoc-discuss" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to pandoc-discus...-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org >> > To view this discussion on the web visit >> https://groups.google.com/d/msgid/pandoc-discuss/6d897324-3d5d-426a-93a3-80140989c6acn%40googlegroups.com >> <https://groups.google.com/d/msgid/pandoc-discuss/6d897324-3d5d-426a-93a3-80140989c6acn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "pandoc-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/6261767e-0a89-4edf-92ae-53ab36cbe052n%40googlegroups.com.