From 9b740df2778bf9af3c072da3e7d2312b140f044b Mon Sep 17 00:00:00 2001 From: Adarsh Patel Date: Sat, 26 Jan 2019 09:48:25 +0530 Subject: [PATCH] api_docs: Specify max width for long code examples. Fixes #10673. --- static/third/bootstrap/css/bootstrap.css | 10 ++++++++++ zerver/lib/bugdown/api_arguments_table_generator.py | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/static/third/bootstrap/css/bootstrap.css b/static/third/bootstrap/css/bootstrap.css index ef4330f7db..23de9383f0 100644 --- a/static/third/bootstrap/css/bootstrap.css +++ b/static/third/bootstrap/css/bootstrap.css @@ -2008,6 +2008,16 @@ table { vertical-align: bottom; } +.table .json-api-example { + width: fit-content; + max-width: 300px; + word-wrap: break-word; +} + +.table .json-api-example code { + white-space: pre-wrap; +} + .table caption + thead tr:first-child th, .table caption + thead tr:first-child td, .table colgroup + thead tr:first-child th, diff --git a/zerver/lib/bugdown/api_arguments_table_generator.py b/zerver/lib/bugdown/api_arguments_table_generator.py index 885f8081d1..d55c332133 100644 --- a/zerver/lib/bugdown/api_arguments_table_generator.py +++ b/zerver/lib/bugdown/api_arguments_table_generator.py @@ -105,7 +105,7 @@ class APIArgumentsTablePreprocessor(Preprocessor): tr = """ {argument} - {example} + {example} {required} {description}