Don't strip formatting when generating docs
poblahblahblah opened this issue · 4 comments
Hello,
Love the project as it's super helpful.
One thing I am wanting to do is embed a valid example of a kubernetes manifest to illustrate how someone can fix a warning or a violation, e.g. if the rule is to check that the container is not running as root, I would like the policy documentation to look something like this:
# @title Containers should not run as root
#
# Containers should not run as root.
#
# The following snippet is an example of how to satisfy this requirement:
#
# ```
# apiVersion: apps/v1
# kind: Deployment
# metadata:
# name: redis
# spec:
# template:
# spec:
# containers:
# - name: redis
# image: redis:6.2
# securityContext:
# runAsNonRoot: true
# runAsUser: 1000
# ```
#
# @kinds apps/DaemonSet apps/Deployment apps/StatefulSet core/Pod
I can do this just fine, but the resulting markdown loses all formatting and renders the following snippet:
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
spec:
template:
spec:
containers:
- name: redis
image: redis:6.2
securityContext:
allowPrivilegeEscalation: false
runAsNonRoot: true
runAsUser: 1000
I'm not sure what is reasonable as I am fairly new to the tool, so any guidance would be appreciated.
Hi @poblahblahblah , thanks for opening this request. This is currently occurring because we trim the comments to make sure our @title
etc. tags are recognized, even if someone accidentally has an extra space or similar.
This should be possible though, and definitely seems useful so we'll look into it.
@poblahblahblah PR #168 should handle this request and it will be included in the next release!
@jpreese That is excellent! Thank you so much!
@poblahblahblah this has been released in v0.14.0
-- https://github.com/plexsystems/konstraint/releases/tag/v0.14.0