aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortilpner2019-05-03 15:31:59 +0200
committertilpner2019-05-03 15:31:59 +0200
commit9dff075fb065d7b97db9663f98af25efe016a9e2 (patch)
tree057f405a6270ed9348f2ad7e34d3372bb9cb9800
parent559e4d09159e6966fe33faed6ddba4de3e9f2412 (diff)
downloadrpb-s3-9dff075fb065d7b97db9663f98af25efe016a9e2.tar.gz
rpb-s3-9dff075fb065d7b97db9663f98af25efe016a9e2.tar.xz
rpb-s3-9dff075fb065d7b97db9663f98af25efe016a9e2.zip
Prevent selection of line numbers in blink
-rw-r--r--src/code.html3
-rw-r--r--src/main.rs4
2 files changed, 5 insertions, 2 deletions
diff --git a/src/code.html b/src/code.html
index 1e009d6..f459b4e 100644
--- a/src/code.html
+++ b/src/code.html
@@ -26,6 +26,9 @@
color: #586e75;
text-decoration: none;
}
+ .linenumbers a:after \{
+ content: attr(data-txt);
+ }
</style>
</head>
<body>
diff --git a/src/main.rs b/src/main.rs
index a86f1c8..6413bea 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -192,9 +192,9 @@ fn highlight(cfg: &Config, mut input: Box<dyn BufRead + Send>) -> impl Iterator<
let mut html = Vec::new();
let mut formatted_line = String::new();
let (_, bg) = start_highlighted_html_snippet(theme);
- let _ = write!(&mut html, "<table><tr><td unselectable=\"on\"><pre class=linenumbers>");
+ let _ = write!(&mut html, "<table><tr><td unselectable=\"on\"><pre class=\"linenumbers\">");
for (i, _line) in input_str.lines().enumerate() {
- let _ = writeln!(&mut html, "<a href=\"#L{}\">{}</a>", i, i);
+ let _ = writeln!(&mut html, "<a href=\"#L{}\" data-txt=\"{}\"></a>", i, i);
}
let _ = write!(&mut html, "</pre></td><td><pre class=code><code>");