-
Notifications
You must be signed in to change notification settings - Fork 158
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
Add range to MarkdownParagraph and MarkdownSpan #411
Changes from 5 commits
1a3186a
779e9f2
c7f78e7
377f5b1
16383d8
2b6f7bb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,10 @@ First, we need to load the assembly and open necessary namespaces: | |
*) | ||
|
||
#r "../../bin/FSharp.Markdown.dll" | ||
#r "../../bin/FSharp.Formatting.Common.dll" | ||
open FSharp.Markdown | ||
open FSharp.Formatting.Common | ||
|
||
|
||
(** | ||
Parsing documents | ||
|
@@ -64,7 +67,7 @@ The following snippet prints the heading of the document: | |
// Iterate over all the paragraph elements | ||
for par in parsed.Paragraphs do | ||
match par with | ||
| Heading(1, [Literal text]) -> | ||
| Heading(1, [Literal(text, _)], _) -> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To encourage people writing the code in the new style - and future-proof way, could you change the pattern matching here to use the naming? For example:
I know this is quite tedious (!) but adding the names to the DUs is a fantastic improvement for the library and it would be great to have it in a couple of places in the docs, so that people know about it - and use it! |
||
// Recognize heading that has a simple content | ||
// containing just a literal (no other formatting) | ||
printfn "%s" text | ||
|
@@ -92,8 +95,8 @@ to recognize any paragraph or span that can contain child elements: | |
/// Returns all links in a specified span node | ||
let rec collectSpanLinks span = seq { | ||
match span with | ||
| DirectLink(_, (url, _)) -> yield url | ||
| IndirectLink(_, _, key) -> yield fst (parsed.DefinedLinks.[key]) | ||
| DirectLink(_, (url, _), _) -> yield url | ||
| IndirectLink(_, _, key, _) -> yield fst (parsed.DefinedLinks.[key]) | ||
| Matching.SpanLeaf _ -> () | ||
| Matching.SpanNode(_, spans) -> | ||
for s in spans do yield! collectSpanLinks s } | ||
|
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.
Out of curiosity, is this a needed change for some reason? (Happy to delete the parameter if it's not needed, but then we should probably delete the whole line 26.)
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.
I didnt removed the parameter from the method declaration when I looked at all scrpts to see if I need to change something I saw error on this line so I change it