summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibMarkdown
AgeCommit message (Collapse)Author
2022-04-28LibMarkdown: Add strike-through text support to markdownhuttongrabiel
Using ~~text~~ syntax will strike out the text between the two tildes. Only missing portion is the terminal rendering of strike through text. The ansi escape codes for strike through text are \e[9m and \e[29m but it appears the terminal does not support these. Please correct me if I am wrong. I tested that the render_to_terminal function was being called by giving it bold ANSI escape codes, and that did work so the function is being called correctly.
2022-04-26LibMarkdown: Correct typo in forward declaration of HorizontalRulehuttongrabiel
HoriziontalRule -> HorizontalRule
2022-04-26LibMarkdown: Treat whitespace-only lines as blank in paragraphsPeter Elliott
2022-04-26LibMarkdown: Don't put a newline in empty code blocksPeter Elliott
This doesn't actually matter, but I'm trying to match the commonmark test cases where possible.
2022-04-26LibMarkdown: Better support for code fencesPeter Elliott
- Support tildes. - Support different lengths of fence. - Begrudgingly keep support for serenities one markdown extension.
2022-04-26LibMarkdown: Support up to 3 spaces before an ATX headerPeter Elliott
2022-04-26LibMarkdown: Limit headings to 6 levelsPeter Elliott
2022-04-26LibMarkdown: Make thematic break parsing more correctPeter Elliott
also fix a conflict with lists and thematic breaks
2022-04-26LibMarkdown: Ignore backslash on non-punctuation charactersPeter Elliott
2022-04-26LibMarkdown: Add support for indented code blocksPeter Elliott
2022-04-01Everywhere: Run clang-formatIdan Horowitz
2022-03-13Libraries: Use default constructors/destructors in LibMarkdownLenny Maiorani
https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#cother-other-default-operation-rules "The compiler is more likely to get the default semantics right and you cannot implement these functions better than the compiler."
2022-02-17LibMarkdown: Add terminal color formattingxSlendiX
This patch adds color formatting to markdown viewed in the terminal. This also increases readability.
2022-02-17LibMarkdown: Add additional spacing for terminal renderingxSlendiX
This patch adds spacing to give a sense of structure to markdown documents viewed in the terminal. This also makes the content easier to read.
2022-01-07Everywhere: Fix spelling mistakesmjz19910
2022-01-06LibMarkdown: Output alignment when rendering HTML tablesSam Atkins
Previously, only terminal output aligned table column contents correctly. Now, we apply a `text-align` to each cell. This does not actually *work* however, since LibWeb's table layout code is not yet fully functional.
2021-11-11Everywhere: Pass AK::StringView by valueAndreas Kling
2021-11-03LibMarkdown: Allow nested linksAndreas Kling
This fixes an issue where the linked images in our README.md didn't get turned into images.
2021-11-01LibMarkdown: Recognize and handle commentsBen Wiederhake
This also improves Commonmark coverage, e.g. it fixes tests HTML_blocks_ex179_2894..2906 and Lists_ex308_5439..5457. In other words, we go from 271 out of 652 to 273 out of 652.
2021-10-10LibMarkdown: Implement introspection of the document treeBen Wiederhake
2021-10-10LibMarkdown: Make href always a StringBen Wiederhake
This already was the case in some sense, but made it very inconvenient to access it.
2021-10-09LibMarkdown: Have one newline between lists in terminal rendersDavid Isaksson
Before this patch the markdown lists would have two space inbetween each item. This patch removes one of these newlines for a nicer render.
2021-10-06LibMarkdown: Add blockquotesPeter Elliott
2021-10-06LibMarkdown: Add blockquote support to LineIteratorPeter Elliott
This patch adds contexts to line iterator for nesting list items and blockquotes. It also incidentally makes the api for LineIterator simpler, and will make it easier to add other containers in the future.
2021-10-05LibMarkdown: Add start numbers for ordered listsPeter Elliott
5. hey -> <ol start="5"><li>hey</li></ol>
2021-10-05LibMarkdown: Allow spaces before list itemsPeter Elliott
also allow '+' as an unordered list marker
2021-10-05LibMarkdown: Implement "tightness" for listsPeter Elliott
From the commonmark spec: A list is loose if any of its constituent list items are separated by blank lines, or if any of its constituent list items directly contain two block-level elements with a blank line between them. Otherwise a list is tight. (The difference in HTML output is that paragraphs in a loose list are wrapped in <p> tags, while paragraphs in a tight list are not.)
2021-10-05LibMarkdown: Allow non-text items in ListsPeter Elliott
2021-10-05LibMarkdown: Add LineIteratorPeter Elliott
LineIterator wraps a vector's ConstIterator, to provide an iterator that can work on indented container blocks (like lists and blockquotes).
2021-10-05LibMarkdown: Refactor Document's parser into ContainerBlockPeter Elliott
This will better allow us too do things like have Lists and blockquotes support multiple blocks.
2021-10-01LibMarkdown: Fix typo in variable nameNico Weber
2021-10-01Libraries: Fix typosNico Weber
2021-09-12LibMarkdown: Re-add support for Serenity's style code blocks extensionPeter Elliott
I decided to not use the text parser for this one and rely on a regex to parse the style tags. This way it supports only and opening delimiter run and also is much simpler.
2021-09-12LibMarkdown: Render sequences of spaces properly in the terminalPeter Elliott
2021-09-12LibMarkdown: Implement hard and soft line breaksPeter Elliott
Hard line breaks insert a <br /> when two spaces are at the end of a line. soft line breaks are just regular newlines, but whitespace is now stripped before and after them
2021-09-12LibMarkdown: Handle delimiter flanking with punctuationPeter Elliott
This patch handles the following two rules 1) A delimiter run is either (a) not followed by a Unicode punctuation character, or (b) followed by a Unicode punctuation character and preceded by Unicode whitespace or a Unicode punctuation character. 2) A _ can be used to open/close a delimiter run if it's (a) not part of a left-flanking delimiter run or (b) part of a left-flanking delimiter run followed by a Unicode punctuation character.
2021-09-12LibMarkdown: Add terminal rendering for new markdown Text parserPeter Elliott
2021-09-12LibMarkdown: Rewrite Inline text parser to be more forgivingPeter Elliott
The previous Text::parse was not able to give up on parsing a textual element, and just leave it as plain text. Because this is a very important part of markdown, I fully rewrote the parser to support this without having to backtrack. Also the parser now some other little features, such ast delimiter runs and flanking.
2021-08-31LibMarkdown: Match HTML formatting of Commonmark testsPeter Elliott
This patch changes the HTML formatting (where to put newlines, etc...) to better match commonmark's test cases. This has minimal effect of the correctness of our markdown implementation, but makes it easier to test. Changes: - Use <em> instead of <i>. - Newline before end of code block. - <hr /> instead of <hr>. - Newline before first list item. - Newline between lines of a paragraph. - Trim whitespace on lines of paragraphs. Tests passed: 33/652 -> 87/652
2021-08-31LibMarkdown: Add render_to_inline_html() to DocumentPeter Elliott
This api is useful when you want to render a markdown document to HTML, but you want to embed it in a existing html document.
2021-06-09LibMarkdown: Wrap non-inline code blocks in <pre>Sam Atkins
This fixes #7131 The parser already distinguishes between inline code (handled in Text.cpp) and triple-tick code blocks, so only CodeBlock::render_to_html() needed to change. Blank lines within a code block still cause issues, but that's an HTML issue. (#7121)
2021-05-19LibMarkdown: Wrap code block language string in escape_html_entities()Linus Groh
This would allow HTML injection as the string was inserted into the HTML output with no sanitation whatsoever. Fixes #7123.
2021-05-07LibMarkdown: Convert StringBuilder::appendf() => AK::FormatAndreas Kling
These are the last ones in the codebase. :^)
2021-05-05LibMarkdown: Convert a bunch of StringBuilder::appendf() => appendff()Andreas Kling
2021-05-01Everywhere: Turn #if *_DEBUG into dbgln_if/if constexprGunnar Beutner
2021-04-22Everything: Move to SPDX license identifiers in all files.Brian Gianforcaro
SPDX License Identifiers are a more compact / standardized way of representing file license information. See: https://spdx.dev/resources/use/#identifiers This was done with the `ambr` search and replace tool. ambr --no-parent-ignore --key-from-file --rep-from-file key.txt rep.txt *
2021-03-26LibMarkdown: Remove unused Paragraph::add_line() declarationLinus Groh
2021-03-17Everywhere: Remove pessimizing and redundant move()Andreas Kling
2021-02-23Everywhere: Rename ASSERT => VERIFYAndreas Kling
(...and ASSERT_NOT_REACHED => VERIFY_NOT_REACHED) Since all of these checks are done in release builds as well, let's rename them to VERIFY to prevent confusion, as everyone is used to assertions being compiled out in release. We can introduce a new ASSERT macro that is specifically for debug checks, but I'm doing this wholesale conversion first since we've accumulated thousands of these already, and it's not immediately obvious which ones are suitable for ASSERT.
2021-02-08Everywhere: Replace dbgln<flag>(...) with dbgln_if(flag, ...)AnotherTest
Replacement made by `find Kernel Userland -name '*.h' -o -name '*.cpp' | sed -i -Ee 's/dbgln\b<(\w+)>\(/dbgln_if(\1, /g'`