summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorJuan Carlos <juancarlospaco@gmail.com>2021-03-16 17:16:20 -0300
committerGitHub <noreply@github.com>2021-03-16 13:16:20 -0700
commitcfe2f126e59eed870e2978ebd263be9ca1be01a3 (patch)
tree4b42393d43abf2450af848e2e9d311004a40e25d
parent48eab5370a5e731059a7337f702b2bc42a3c4b79 (diff)
downloadNim-cfe2f126e59eed870e2978ebd263be9ca1be01a3.tar.gz
Documentation only jsconsole (#17384)
Co-authored-by: Danil Yarantsev <tiberiumk12@gmail.com>
Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
-rw-r--r--lib/js/jsconsole.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/js/jsconsole.nim b/lib/js/jsconsole.nim
index 8b0bc2620..b8a361af1 100644
--- a/lib/js/jsconsole.nim
+++ b/lib/js/jsconsole.nim
@@ -9,6 +9,18 @@
 
 ## Wrapper for the `console` object for the `JavaScript backend
 ## <backends.html#backends-the-javascript-target>`_.
+##
+## Styled Messages
+## ===============
+##
+## CSS-styled messages in the browser are useful for debugging purposes.
+## To use them, prefix the message with one or more `%c`,
+## and provide the CSS style as the last argument.
+## The amount of `%c`'s must match the amount of CSS-styled strings.
+##
+runnableExamples("-r:off"):
+  console.log "%c My Debug Message", "color: red" # Notice the "%c"
+  console.log "%c My Debug %c Message", "color: red", "font-size: 2em"
 
 import std/private/since, std/private/miscdollars  # toLocation