Compare commits
1 Commits
docs/contr
...
ci/one-sen
| Author | SHA1 | Date | |
|---|---|---|---|
|
46b59d743e
|
14
.markdownlint-cli2.jsonc
Normal file
14
.markdownlint-cli2.jsonc
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"customRules": [".markdownlint-rules/one-sentence-per-line.mjs"],
|
||||
"config": {
|
||||
"default": true,
|
||||
"heading-style": { "style": "atx" },
|
||||
"ul-indent": { "indent": 2 },
|
||||
"line-length": false,
|
||||
"no-duplicate-heading": { "siblings_only": true },
|
||||
"no-inline-html": {
|
||||
"allowed_elements": ["br", "code", "details", "summary", "img", "picture", "source"]
|
||||
},
|
||||
"first-line-heading": true
|
||||
}
|
||||
}
|
||||
48
.markdownlint-rules/one-sentence-per-line.mjs
Normal file
48
.markdownlint-rules/one-sentence-per-line.mjs
Normal file
@@ -0,0 +1,48 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @typedef {object} ErrorInfo
|
||||
* @property {number} lineNumber
|
||||
* @property {string} [context]
|
||||
* @property {string} [detail]
|
||||
* @property {[number, number]} [range]
|
||||
*/
|
||||
|
||||
/**
|
||||
* @typedef {object} Params
|
||||
* @property {string[]} lines
|
||||
*/
|
||||
|
||||
/** @typedef {(error: ErrorInfo) => void} OnError */
|
||||
|
||||
/**
|
||||
* @typedef {object} Rule
|
||||
* @property {string[]} names
|
||||
* @property {string} description
|
||||
* @property {string[]} tags
|
||||
* @property {(params: Params, onError: OnError) => void} function
|
||||
*/
|
||||
|
||||
/** @type {Rule} */
|
||||
export default {
|
||||
names: ["one-sentence-per-line"],
|
||||
description: "Each sentence must be on its own line",
|
||||
tags: ["sentences"],
|
||||
function: function (params, onError) {
|
||||
let inFence = false;
|
||||
params.lines.forEach((line, index) => {
|
||||
if (/^```/.test(line)) {
|
||||
inFence = !inFence;
|
||||
return;
|
||||
}
|
||||
if (inFence) return;
|
||||
// Skip headings, blank lines, HTML, table rows
|
||||
if (/^(#|\s*[|<]|>|\s*$)/.test(line)) return;
|
||||
// Strip list marker before checking
|
||||
const text = line.replace(/^\s*(?:[-*+]|\d+\.)\s+/, "");
|
||||
if (/[.!?]\s+[A-Z]/.test(text)) {
|
||||
onError({ lineNumber: index + 1, context: text.trim() });
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
@@ -1,17 +0,0 @@
|
||||
default: true
|
||||
heading-style:
|
||||
style: atx
|
||||
ul-indent:
|
||||
indent: 2
|
||||
line-length: false
|
||||
no-duplicate-heading:
|
||||
siblings_only: true
|
||||
no-inline-html:
|
||||
allowed_elements:
|
||||
- br
|
||||
- details
|
||||
- summary
|
||||
- img
|
||||
- picture
|
||||
- source
|
||||
first-line-heading: true
|
||||
@@ -1,3 +1,6 @@
|
||||
# <img height="30" src="assets/logo.svg" alt="Go Cuckoo, by `mvhutz`."> Go Cuckoo
|
||||
|
||||
A hash table that uses cuckoo hashing to achieve a worst-case O(1) lookup time. Read more about it in [the package documentation](https://pkg.go.dev/git.maximhutz.com/tools/go-cuckoo).
|
||||
A hash table that uses cuckoo hashing to achieve a worst-case O(1) lookup time.
|
||||
Read more about it in [the package documentation][docs].
|
||||
|
||||
[docs]: https://pkg.go.dev/git.maximhutz.com/tools/go-cuckoo
|
||||
|
||||
Reference in New Issue
Block a user