removed: section in outline

fixed: tag detection
This commit is contained in:
quenousimporte 2023-01-30 12:16:59 +01:00
parent e0ec91ee29
commit d0c6693ff7
1 changed files with 12 additions and 4 deletions

16
main.js
View File

@ -552,7 +552,7 @@ function showoutline()
getnotecontent().split("\n").forEach((line, index, lines) => getnotecontent().split("\n").forEach((line, index, lines) =>
{ {
pos += line.length + 1; pos += line.length + 1;
if (line.startsWith("#") || line == "---") if (line.startsWith("#"))
{ {
line = line line = line
.replace("# ", "") .replace("# ", "")
@ -602,12 +602,20 @@ function linkatpos()
function tagatpos() function tagatpos()
{ {
if (md.value.lastIndexOf("tags: ", md.selectionStart) < md.value.lastIndexOf("\n", md.selectionStart))
{
return null;
}
var start = md.value.lastIndexOf(" ", md.selectionStart); var start = md.value.lastIndexOf(" ", md.selectionStart);
if (start == -1 || md.value.substring(start, md.selectionStart).indexOf("\n") != -1) return ""; if (start == -1 || md.value.substring(start, md.selectionStart).indexOf("\n") != -1) return "";
var nextcomma = md.value.indexOf(",", md.selectionStart); var end = md.value.indexOf(",", md.selectionStart);
var nexteol = md.value.indexOf("\n", md.selectionStart); if (end == -1)
var end = Math.min(nexteol, nextcomma); {
end = md.value.indexOf("\n", md.selectionStart);
}
if (end == -1 || md.value.substring(md.selectionStart, end).indexOf("\n") != -1) return ""; if (end == -1 || md.value.substring(md.selectionStart, end).indexOf("\n") != -1) return "";
return md.value.substring(start + 1, end); return md.value.substring(start + 1, end);