diff --git a/cmd/tools/vdoc-resources/doc.css b/cmd/tools/vdoc-resources/doc.css index 23147df5c8..0a75d706e3 100644 --- a/cmd/tools/vdoc-resources/doc.css +++ b/cmd/tools/vdoc-resources/doc.css @@ -260,6 +260,9 @@ body { padding: 1rem; overflow: hidden; } +.doc-content p { + line-height: 1.4; +} .doc-content a { color: #2779bd; color: var(--link-color); @@ -267,6 +270,9 @@ body { .doc-content > .doc-node { padding: 5rem 0 2rem 0; margin-top: -4rem; + overflow: hidden; + word-break: break-all; /* IE11 */ + word-break: break-word; } .doc-content > .doc-node.const:not(:first-child) { padding-top: 0; @@ -408,6 +414,11 @@ pre, code, pre code { font-size: 0.9rem; text-shadow: none; font-family: monospace; + background-color: #edf2f7; + background-color: var(--code-background-color); + border-radius: 0.25rem; +} +pre code { direction: ltr; text-align: left; white-space: pre; @@ -421,14 +432,13 @@ pre, code, pre code { -moz-hyphens: none; -ms-hyphens: none; hyphens: none; - background-color: #edf2f7; - background-color: var(--code-background-color); display: block; - border-radius: 0.25rem; overflow-x: auto; + padding: 1rem; } -code, pre code { - padding: 1rem; +code { + padding: 0.2rem; + vertical-align: middle; } pre { overflow: auto; diff --git a/cmd/tools/vdoc-resources/normalize.css b/cmd/tools/vdoc-resources/normalize.css index 284c560600..d9fbe676a5 100644 --- a/cmd/tools/vdoc-resources/normalize.css +++ b/cmd/tools/vdoc-resources/normalize.css @@ -39,7 +39,6 @@ strong { font-weight: bolder; } -code, kbd, samp { font-family: monospace, monospace; diff --git a/cmd/tools/vdoc.v b/cmd/tools/vdoc.v index 21e926b1c9..86202cd96a 100644 --- a/cmd/tools/vdoc.v +++ b/cmd/tools/vdoc.v @@ -573,7 +573,12 @@ fn (mut cfg DocConfig) generate_docs_from_file() { for dirpath in dirs { cfg.vprintln('Generating docs for ${dirpath}...') mut dcs := doc.generate(dirpath, cfg.pub_only, true) or { - panic(err) + mut err_msg := err + if errcode == 1 { + err_msg += ' Use the `-m` flag if you are generating docs of a directory with multiple modules inside.' + } + eprintln(err_msg) + exit(1) } if dcs.contents.len == 0 { continue } if cfg.is_multi { diff --git a/vlib/v/doc/doc.v b/vlib/v/doc/doc.v index 194c0b7f3d..7432736a16 100644 --- a/vlib/v/doc/doc.v +++ b/vlib/v/doc/doc.v @@ -244,11 +244,11 @@ pub fn (mut d Doc) generate() ?bool { // get all files base_path := if os.is_dir(d.input_path) { d.input_path } else { os.real_path(os.base_dir(d.input_path)) } project_files := os.ls(base_path) or { - panic(err) + return error_with_code(err, 0) } v_files := d.prefs.should_compile_filtered_files(base_path, project_files) if v_files.len == 0 { - return error('vdoc: No valid V files were found.') + return error_with_code('vdoc: No valid V files were found.', 1) } // parse files mut file_asts := []ast.File{} @@ -383,7 +383,7 @@ pub fn generate(input_path string, pub_only, with_comments bool) ?Doc { doc.pub_only = pub_only doc.with_comments = with_comments doc.generate() or { - return error(err) + return error_with_code(err, errcode) } return doc }