add horizontal rule lexicon

nulfrost 6b5bad56 44ba46f9

Changed files
+33 -16
lexicons
pub
leaflet
lib
lexicons
types
pub
leaflet
+1 -1
lex.config.js
··· 2 2 3 3 export default defineLexiconConfig({ 4 4 files: ["lexicons/**/*.json"], 5 - outdir: "src/lexicons/", 5 + outdir: "lib/lexicons/", 6 6 });
+11
lexicons/pub/leaflet/blocks/horizontalRule.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "pub.leaflet.blocks.horizontalRule", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "required": [], 8 + "properties": {} 9 + } 10 + } 11 + }
+1
lib/lexicons/index.ts
··· 1 1 export * as ComAtprotoRepoStrongRef from "./types/com/atproto/repo/strongRef.js"; 2 2 export * as PubLeafletBlocksCode from "./types/pub/leaflet/blocks/code.js"; 3 3 export * as PubLeafletBlocksHeader from "./types/pub/leaflet/blocks/header.js"; 4 + export * as PubLeafletBlocksHorizontalRule from "./types/pub/leaflet/blocks/horizontalRule.js"; 4 5 export * as PubLeafletBlocksImage from "./types/pub/leaflet/blocks/image.js"; 5 6 export * as PubLeafletBlocksMath from "./types/pub/leaflet/blocks/math.js"; 6 7 export * as PubLeafletBlocksText from "./types/pub/leaflet/blocks/text.js";
+16
lib/lexicons/types/pub/leaflet/blocks/horizontalRule.ts
··· 1 + import type {} from "@atcute/lexicons"; 2 + import * as v from "@atcute/lexicons/validations"; 3 + 4 + const _mainSchema = /*#__PURE__*/ v.object({ 5 + $type: /*#__PURE__*/ v.optional( 6 + /*#__PURE__*/ v.literal("pub.leaflet.blocks.horizontalRule"), 7 + ), 8 + }); 9 + 10 + type main$schematype = typeof _mainSchema; 11 + 12 + export interface mainSchema extends main$schematype {} 13 + 14 + export const mainSchema = _mainSchema as mainSchema; 15 + 16 + export interface Main extends v.InferInput<typeof mainSchema> {}
+4 -15
lib/utils.ts
··· 163 163 (segment) => segment.$type === "pub.leaflet.richtext.facet#italic", 164 164 ); 165 165 if (isCode) { 166 - children.push(` <code> 167 - ${segment.text} 168 - </code>`); 166 + children.push(`<code>${segment.text}</code>`); 169 167 } else if (link) { 170 168 children.push( 171 - ` <a 172 - href="${link.uri}" 173 - target="_blank" 174 - > 175 - ${segment.text} 176 - </a>`, 169 + `<a href="${link.uri}" target="_blank">${segment.text}</a>`, 177 170 ); 178 171 } else if (isBold) { 179 172 children.push(`<b>${segment.text}</b>`); ··· 186 179 } else if (isItalic) { 187 180 children.push(`<i>${segment.text}</i>`); 188 181 } else { 189 - children.push( 190 - ` 191 - ${segment.text} 192 - `, 193 - ); 182 + children.push(`${segment.text}`); 194 183 } 195 184 } 196 - html += `<p>${children.join("\n")}</p>`; 185 + html += `<p>${children}</p>`; 197 186 } 198 187 199 188 if (is(PubLeafletBlocksHeader.mainSchema, block.block)) {