Giter VIP home page Giter VIP logo

Comments (6)

tpetricek avatar tpetricek commented on July 20, 2024

Hi,
this looks very cool! I would be happy to include both of the extensions in the project.

A) The code for tables looks pretty good to me, so if you can send a pull request, we can include that almost immediately. The only thing that might not work in your current version is the bit in Markdown.fs in Matching.

You added a case to the (|ParagraphLeaf|ParagraphNested|ParagraphSpans|) active pattern (which returns cells of the table as a list of paragraphs), but you did not include case in ParagraphNested that would re-construct the table value. Ideally, you should be able to write:

match node with
| ParagraphNested(info, pars) -> ParagraphNested(info, List.map processRecursively pars)

(to process the tree - I wrote more about this at the end of my F# Deep Dives chapter)

The problem is that ParagraphNested returns list<MarkdownParagraph> and if we turn list<list<MarkdownParagraph>> to just a non-nested list, then there is no easy way to reconstruct the original table. I think we could probably change the active pattern to return list<list<MP>> instead of just list<MP>.

B) Having some features for mathematics has been on my wish list too :-), so feel free to add some extension for that and send a pull request!

At the moment, we only have HTML output, but it should not be too hard to turn MarkdownParagraphs to latex similarly to how HtmlFormatting.fs works (and I would really like to have this feature!) But maybe there is a more direct way to get PDF?

from fsharp.formatting.

tpetricek avatar tpetricek commented on July 20, 2024

I believe most of this is now included, right?

from fsharp.formatting.

findemor avatar findemor commented on July 20, 2024

I just downloaded FSharp.Formatting using VS2012 Nuget Manager. I was very interested in parsing markdown tables and formatting it as HTML, but I tried to parse this:

------ --------------- ----------
**Id** **Description** **Link**
1      _text_          [url](url)
2      *text*          [url](url)

with this code

MarkdownDocument FDocument = Markdown.Parse(MdContent);
string FHtml = Markdown.WriteHtml(FDocument);

and it appears in this mode (1 line):

<p><strong>Id</strong> <strong>Description</strong> <strong>Link</strong>
1      <em>text</em>          <a href="url">url</a>
2      <em>text</em>          <a href="url">url</a></p> 

Is the nuget repository updated to this version? Or I am doing something wrong?

Thank you in advance!

from fsharp.formatting.

tpetricek avatar tpetricek commented on July 20, 2024

I think the actual format of the tables that we currently support is a bit different. Check out the samples here: #9

from fsharp.formatting.

findemor avatar findemor commented on July 20, 2024

Wow, thank you!! It works like a charm! :)

from fsharp.formatting.

tpetricek avatar tpetricek commented on July 20, 2024

Cool :-)

from fsharp.formatting.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.