summaryrefslogtreecommitdiff
path: root/Libraries/LibMarkdown
AgeCommit message (Collapse)Author
2021-01-12Libraries: Move to Userland/Libraries/Andreas Kling
2021-01-12AK: Simplify constructors and conversions from nullptr_tLenny Maiorani
Problem: - Many constructors are defined as `{}` rather than using the ` = default` compiler-provided constructor. - Some types provide an implicit conversion operator from `nullptr_t` instead of requiring the caller to default construct. This violates the C++ Core Guidelines suggestion to declare single-argument constructors explicit (https://isocpp.github.io/CppCoreGuidelines/CppCoreGuidelines#c46-by-default-declare-single-argument-constructors-explicit). Solution: - Change default constructors to use the compiler-provided default constructor. - Remove implicit conversion operators from `nullptr_t` and change usage to enforce type consistency without conversion.
2021-01-11Everywhere: Fix incorrect uses of String::format and StringBuilder::appendfSahan Fernando
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.
2021-01-11Vector: Implement `find`, `find_if`, `find_first_matching` in terms of ↵Lenny Maiorani
`AK::find*` Problem: - The implementation of `find` is coupled to the implementation of `Vector`. - `Vector::find` takes the predicate by value which might be expensive. Solution: - Decouple the implementation of `find` from `Vector` by using a generic `find` algorithm. - Change the name of `find` with a predicate to `find_if` so that a binding reference can be used and the predicate can be forwarded to avoid copies. - Change all the `find(pred)` call sites to use `find_if`.
2021-01-09Everywhere: Replace a bundle of dbg with dbgln.asynts
These changes are arbitrarily divided into multiple commits to make it easier to find potentially introduced bugs with git bisect.Everything: The modifications in this commit were automatically made using the following command: find . -name '*.cpp' -exec sed -i -E 's/dbg\(\) << ("[^"{]*");/dbgln\(\1\);/' {} \;
2021-01-02LibMarkdown: Parse horizontal rulesAndreas Kling
A horizontal rule is generated by a line with three or more of these characters: '*', '-', '_'.
2020-11-30LibMarkdown: Reduce debug spam from invalid characters in table headingsLuke
Happens a lot when fuzzing.
2020-11-29LibMarkdown: Only consider "!" a special character when followed by "["Linus Groh
Fixes #4220.
2020-10-31LibMarkdown: Use JS::MarkupGenerator for "js" code blocks :^)Linus Groh
2020-10-31LibMarkdown: Replace inline styles in HTML with CSS in <head>Linus Groh
2020-10-26LibMarkdown: Don't parse lines starting with a space as headingLinus Groh
This fixes a bug where lines starting with a space would get parsed as "level 0" headings - it would not find a "#" and therefore never increase the level counter (starting at zero), which then would cause the check for "space after #" pass (again, there is no "#"). Eventually we would get funny results like this: <h0>[n-1 spaces]oops!</h0> Also ASSERT(level > 0) in the Heading constructor.
2020-10-26LibMarkdown: Flush the pending paragraphs when encountering empty linesAnotherTest
Fixes #3854.
2020-09-27LibMarkdown: Parse paragraphs line-wiseAnotherTest
This gets rid of the doubled-up checks in `Paragraph::parse()`, and makes a paragraph the last possible kind of block to be parsed.
2020-09-27LibMarkdown: Add support for TablesAnotherTest
This adds support for GFM-like tables. The HTML rendering ignores the alignments and relative sizes, but the terminal view does not!
2020-09-27LibMarkdown: Add a Text(String) constructorAnotherTest
2020-09-27LibMarkdown: Make Text default-constructible and move-assignableAnotherTest
2020-09-27LibMarkdown: Take a 'view_width' argument for render_for_terminal()AnotherTest
Some constructs will require the width of the terminal (or a general 'width') to be rendered correctly, such as tables.
2020-09-25Meta+LibHTTP through LibWeb: Make clang-format-10 cleanBen Wiederhake
2020-09-12LibMarkdown: Make warning messages conditionalBen Wiederhake
This is especially a problem during fuzzing.
2020-07-14LibMarkdown: Reset offset to 0 on each new List lineNico Weber
Found by FuzzMarkdown.
2020-05-30LibMarkdown: Change internal MD API to return OwnPtrsFalseHonesty
Previously, all Markdown blocks had a virtual parse method which has been swapped out for a static parse method returning an OwnPtr of that block's type. The Text class also now has a static parse method that will return an Optional<Text>.
2020-05-30LibMarkdown: Change MD Document parse API to return a RefPtrFalseHonesty
Markdown documents are now obtained via the static Document::parse method, which returns a RefPtr<Document>, or nullptr on failure.
2020-05-14Build: Switch to CMake :^)Sergey Bugaev
Closes https://github.com/SerenityOS/serenity/issues/2080
2020-05-09LibMarkdown: Turn absolute links into hyperlinks in terminal output :^)Andreas Kling
I'm not completely sure how to handle this nicely for relative links but it would be nice to do that too.
2020-05-05LibMarkdown: Escape HTML entities in textLinus Groh
2020-05-05LibMarkdown: Use escape_html_entities() from AK/StringLinus Groh
2020-05-04LibMarkdown: Support multi-line list itemsSergey Bugaev
You can now continue one list item across several lines, as long as you indent it the same as the first line of the item. For example: * This is the first item, which spans multiple lines. * This is the second item, which also has some *emphasis* in it.
2020-04-30LibMarkdown: Add support for images :^)Sergey Bugaev
2020-04-30LibMarkdown: Handle broken link markup betterSergey Bugaev
Let's output *something* instead of crashing on a failed assertion.
2020-04-28LibMarkdown: Drop MD prefixes and move into "Markdown" namespace :^)Andreas Kling
2020-03-08Userspace: Add missing #includes now that AK/StdLibExtras.h is smallerAndreas Kling
2020-02-29LibMarkdown: Fix breakage from Vector using size_tAndreas Kling
It's no longer possible rely on negative VectorIterator when iterating backwards. It would be nice to have a general solution for reverse iteration, but for now let me just patch this up.
2020-02-25AK: Make Vector use size_t for its size and capacityAndreas Kling
2020-02-14AK: Add a forward declaration headerAndreas Kling
You can now #include <AK/Forward.h> to get most of the AK types as forward declarations. Header dependency explosion is one of the main contributors to compile times at the moment, so this is a step towards smaller include graphs.
2020-01-24Meta: Claim copyright for files created by meSergey Bugaev
This changes copyright holder to myself for the source code files that I've created or have (almost) completely rewritten. Not included are the files that were significantly changed by others even though it was me who originally created them (think HtmlView), or the many other files I've contributed code to.
2020-01-18Meta: Add license header to source filesAndreas Kling
As suggested by Joshua, this commit adds the 2-clause BSD license as a comment block to the top of every source file. For the first pass, I've just added myself for simplicity. I encourage everyone to add themselves as copyright holders of any file they've added or modified in some significant way. If I've added myself in error somewhere, feel free to replace it with the appropriate copyright holder instead. Going forward, all new source files should include a license header.
2019-12-20Build: clean up build system, use one shared Makefilejoshua stein
Allow everything to be built from the top level directory with just 'make', cleaned with 'make clean', and installed with 'make install'. Also support these in any particular subdirectory. Specifying 'make VERBOSE=1' will print each ld/g++/etc. command as it runs. Kernel and early host tools (IPCCompiler, etc.) are built as object.host.o so that they don't conflict with other things built with the cross-compiler.
2019-12-09AK: Use size_t for the length of stringsAndreas Kling
Using int was a mistake. This patch changes String, StringImpl, StringView and StringBuilder to use size_t instead of int for lengths. Obviously a lot of code needs to change as a result of this.
2019-12-02LibMarkdown: Handle CRLF line endingsTommy Nguyen
Previously, MDDocument only split on Unix-style line endings. This adds a new function to StringView which handles LF, CR and CRLF.
2019-10-30LibMarkdown: Include a <head> element when rendering MD to HTMLAndreas Kling
This should really be handled by LibHTML, but just include a <head> element for now, so generated man pages always have a <head>.
2019-10-13LibMarkdown: Emit properly formed HTML documentsAndreas Kling
2019-10-03LibMarkdown: Avoid emitting <pre> tags for now, to help LibHTMLAndreas Kling
LibHTML can't handle block children of inline elements just yet.
2019-10-03LibMarkdown: Implement link supportSergey Bugaev
We can now parse links that like this: visit the [SerenityOS home page](http://www.serenityos.org/) producing proper <a> HTML elements ^)
2019-09-28LibMarkdown: Support escaping of special charactersAndreas Kling
This allows you to escape function\_names\_like\_this() :^)
2019-09-28Libraries: Add LibMarkdownSergey Bugaev