diff --git a/components/prism-docker.js b/components/prism-docker.js index c075828a80..270e66c554 100644 --- a/components/prism-docker.js +++ b/components/prism-docker.js @@ -4,7 +4,10 @@ Prism.languages.docker = { lookbehind: true }, 'string': /("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/, - 'comment': /#.*/, + 'comment': { + pattern: /#.*/, + greedy: true + }, 'punctuation': /---|\.\.\.|[:[\]{}\-,|>?]/ }; diff --git a/components/prism-docker.min.js b/components/prism-docker.min.js index ec55d3aa24..9c1b73ff6d 100644 --- a/components/prism-docker.min.js +++ b/components/prism-docker.min.js @@ -1 +1 @@ -Prism.languages.docker={keyword:{pattern:/(^\s*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)/im,lookbehind:!0},string:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,comment:/#.*/,punctuation:/---|\.\.\.|[:[\]{}\-,|>?]/},Prism.languages.dockerfile=Prism.languages.docker; \ No newline at end of file +Prism.languages.docker={keyword:{pattern:/(^\s*)(?:ADD|ARG|CMD|COPY|ENTRYPOINT|ENV|EXPOSE|FROM|HEALTHCHECK|LABEL|MAINTAINER|ONBUILD|RUN|SHELL|STOPSIGNAL|USER|VOLUME|WORKDIR)(?=\s)/im,lookbehind:!0},string:/("|')(?:(?!\1)[^\\\r\n]|\\(?:\r\n|[\s\S]))*\1/,comment:{pattern:/#.*/,greedy:!0},punctuation:/---|\.\.\.|[:[\]{}\-,|>?]/},Prism.languages.dockerfile=Prism.languages.docker; \ No newline at end of file diff --git a/examples/prism-docker.html b/examples/prism-docker.html index 325d65035c..206d84314a 100644 --- a/examples/prism-docker.html +++ b/examples/prism-docker.html @@ -2,6 +2,8 @@
# These are the comments for a dockerfile.
# I want to make sure $(variables) don't break out,
# and we shouldn't see keywords like ADD or ENTRYPOINT
+
+# I also want to make sure that this "string" and this 'string' don't break out.