diff --git a/RELEASE_CHECKLIST.md b/RELEASE_CHECKLIST.md index 02ba16e7f4..9bf9726090 100644 --- a/RELEASE_CHECKLIST.md +++ b/RELEASE_CHECKLIST.md @@ -22,5 +22,7 @@ - [ ] Create a signed tag locally and push it up. Tag should be named `xx.yy.zz`. - [ ] Go to Github and add release notes from the relevant `CHANGELOG` section. - [ ] Bump constraints in league/commonmark-extras (and other official extensions) and tag a new release of them + - [ ] Resync project on + - [ ] Update release notes and supported branches on Tidelift - [ ] ??? - [ ] PROFIT!! diff --git a/docs/1.0/basic-usage.md b/docs/1.0/basic-usage.md index ce1ba742b4..170bb699f5 100644 --- a/docs/1.0/basic-usage.md +++ b/docs/1.0/basic-usage.md @@ -24,13 +24,13 @@ echo $converter->convertToHtml('# Hello World!'); **Important:** See the [security](/1.0/security/) section for important details on avoiding security misconfigurations. -The actual conversion process requires three steps: +The actual conversion process has three steps: - 1. Create an `Environment`, adding whichever extensions/parser/renders you need + 1. Creating an `Environment`, adding whichever extensions/parser/renders you need 2. Parsing the Markdown input into an AST 3. Rendering the AST document as HTML -You can do this yourself if you wish: +`CommonMarkConverter` handles this for you, but you can execute that process yourself if you wish: ~~~php renderBlock($document); [Additional customization](/1.0/customization/overview/) is also possible. +## Supported Character Encodings + Please note that only UTF-8 and ASCII encodings are supported. If your Markdown uses a different encoding please convert it to UTF-8 before running it through this library. diff --git a/docs/1.0/customization/block-parsing.md b/docs/1.0/customization/block-parsing.md index e60212a371..1d5f6c7742 100644 --- a/docs/1.0/customization/block-parsing.md +++ b/docs/1.0/customization/block-parsing.md @@ -12,7 +12,13 @@ Block parsers should implement `BlockParserInterface` and implement the followin ## parse() -When parsing a new line, the `DocParser` iterates through all registered block parsers and calls their `parse()` method. Each parser must determine whether it can handle the given line; if so, it should parse the given block and return true. +~~~php +` | +| `isCode()` | Returns whether this block represents an extra-greedy `` block | | `matchesNextLine(...)` | Returns whether this block continues onto the next line (some blocks are multi-line) | | `shouldLastLineBeBlank()` | Returns whether the last line should be blank (primarily used by `ListItem` elements) | | `finalize(...)` | Finalizes the block after all child items have been added, thus marking it as closed for modification | diff --git a/docs/1.0/customization/block-rendering.md b/docs/1.0/customization/block-rendering.md index 49eb7f9176..9b32acd20f 100644 --- a/docs/1.0/customization/block-rendering.md +++ b/docs/1.0/customization/block-rendering.md @@ -14,6 +14,12 @@ All block renderers should implement `BlockRendererInterface` and its `render()` ## render() +~~~php + 'https://github.com'], 'GitHub'); +$img = new HtmlElement('img', ['src' => 'logo.jpg'], '', true); +~~~ ## Designating Block Renderers -When registering your render, you must tell the `Environment` which block element class your renderer should handle. For example: +When registering your renderer, you must tell the `Environment` which block element class your renderer should handle. For example: ~~~php addInlineParser(new EmojiParser(), 20) - ->addDocumentProcessor(new ReplaceUnicodeEmojiProcessor(), 0) ->addInlineRenderer(Emoji::class, new EmojiRenderer(), 0) ; } diff --git a/docs/1.0/customization/overview.md b/docs/1.0/customization/overview.md index 17b2ed9473..59e1235c4a 100644 --- a/docs/1.0/customization/overview.md +++ b/docs/1.0/customization/overview.md @@ -34,6 +34,10 @@ otherwise you abort and the engine will try other parsers. If no parser succeed Simple delimiter-based inlines (like emphasis, strikethrough, etc.) can be parsed without needing a dedicated inline parser by leveraging the new [Delimiter Processing](/1.0/customization/delimiter-processing/) functionality. +## AST manipulation + +Once the [Abstract Syntax Tree](/1.0/customization/abstract-syntax-tree/) is parsed, you are free to access/manipulate it as needed before it's passed into the rendering engine. + ## Customize HTML Output with Custom Renderers Renders convert the parsed blocks/inlines from the AST representation into HTML. There are two types of renderers: @@ -44,10 +48,6 @@ Renders convert the parsed blocks/inlines from the AST representation into HTML. When registering these with the environment, you must tell it which block/inline classes it should handle. This allows you to essentially "swap out" built-in renderers with your own. -## AST manipulation - -Once the [Abstract Syntax Tree](/1.0/customization/abstract-syntax-tree/) is parsed, you are free to access/manipulate it as needed before it's passed into the rendering engine. - ## Examples Some examples of what's possible: diff --git a/docs/1.0/security.md b/docs/1.0/security.md index eb70952a4e..13b0fee708 100644 --- a/docs/1.0/security.md +++ b/docs/1.0/security.md @@ -8,6 +8,14 @@ redirect_from: /0.20/security/ Security ======== +In order to be fully compliant with the CommonMark spec, certain security settings are disabled by default. You will want to configure these settings if untrusted users will be providing the Markdown content: + + - `html_input`: How to handle raw HTML + - `allow_unsafe_links`: Whether unsafe links are permitted + - `max_nesting_level`: Protected against long render times or segfaults + +Further information about each option can be found below. + ## HTML Input **All HTML input is unescaped by default.** This behavior ensures that league/commonmark is 100% compliant with the CommonMark spec.