Skip to content

Commit 0a1718e

Browse files
committed
correct some headings in markdown generation
1 parent f471f6a commit 0a1718e

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

robotcode/language_server/robotframework/diagnostics/library_doc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -417,10 +417,12 @@ def to_markdown(self, add_signature: bool = True, header_level: int = 0, add_typ
417417

418418
def _get_signature(self, header_level: int, add_type: bool = True) -> str:
419419
if add_type:
420-
result = f"\n\n#{'#'*header_level} {'Library' if self.is_initializer else 'Keyword'} *{self.name}*"
420+
result = f"#{'#'*header_level} {'Library' if self.is_initializer else 'Keyword'} *{self.name}*"
421421
else:
422422
if not self.is_initializer:
423423
result = f"\n\n#{'#'*header_level} {self.name}"
424+
else:
425+
result = ""
424426

425427
if self.args:
426428

robotcode/language_server/robotframework/parts/code_action.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,14 @@ def do_GET(self) -> None: # noqa: N802
5959
self.end_headers()
6060

6161
def calc_md() -> str:
62-
return (
63-
libdoc.to_markdown(add_signature=False, only_doc=False)
64-
.replace("\\", "\\")
65-
.replace("`", "\\`")
66-
.replace("$", "\\$")
62+
tt = str.maketrans(
63+
{
64+
"\\": "\\\\",
65+
"`": "\\`",
66+
"$": "\\$",
67+
}
6768
)
69+
return libdoc.to_markdown(add_signature=False, only_doc=False).translate(tt)
6870

6971
data = f"""\
7072
<!doctype html>

0 commit comments

Comments
 (0)