Configuration options? #662
-
I'm looking for the configuration options that can be passed to League\CommonMark\CommonMarkConverter::__construct and Environment, but can't find that anywhere in the docs, source docs, or tests. Am I missing something? The only other reference I can find is #42, but I can't believe that's an exhaustive list. |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments
-
There are currently only three configuration options, and they're all under the $defaultConfig = [
'renderer' => [
'block_separator' => "\n",
'inner_separator' => "\n",
'soft_break' => "\n",
],
]; There simply hasn't been a need to configure additional settings, but the mechanism is there should we need it. #42 demonstrates some examples of how we could expand the configuration in the future. In addition, it's entirely possible for custom extensions to define their own configuration options as needed. I'm definitely open to any ideas or PRs you have for new configuration options. I'll keep this issue open until the current options have been documented properly. |
Beta Was this translation helpful? Give feedback.
-
@colinodell, so I'd need to roll my own parser to get an HTML safe version (one that escapes all HTML input, e.g. has no allowed tags)? |
Beta Was this translation helpful? Give feedback.
-
Unfortunately that is not currently configurable. If you want to escape all HTML output, I'd think that excluding the HTML parsers ( I think having a configuration option for HTML is a fantastic idea though, and it's definitely something I'd want to have implemented before a v1.0 release. |
Beta Was this translation helpful? Give feedback.
-
You could also look at replacing the renderers instead (with ones that escape the raw HTML output). |
Beta Was this translation helpful? Give feedback.
-
Cool, I'll take a look. |
Beta Was this translation helpful? Give feedback.
-
Configuration documentation can now be found at https://commonmark.thephpleague.com/configuration/ |
Beta Was this translation helpful? Give feedback.
Configuration documentation can now be found at https://commonmark.thephpleague.com/configuration/