- ✅ Ticket 1.1: Estructura Clean Architecture en backend - ✅ Ticket 1.2: Schemas Zod compartidos - ✅ Ticket 1.3: Refactorización drugs.ts (1362 → 8 archivos modulares) - ✅ Ticket 1.4: Refactorización procedures.ts (3583 → 6 archivos modulares) - ✅ Ticket 1.5: Eliminación de duplicidades (~50 líneas) Cambios principales: - Creada estructura Clean Architecture en backend/src/ - Schemas Zod compartidos en backend/src/shared/schemas/ - Refactorización modular de drugs y procedures - Utilidades genéricas en src/utils/ (filter, validation) - Eliminados scripts obsoletos y documentación antigua - Corregidos errores: QueryClient, import test-error-handling - Build verificado y funcionando correctamente
57 lines
1.3 KiB
JavaScript
57 lines
1.3 KiB
JavaScript
/**
|
|
* @import {CompileContext, Handle, HtmlExtension, Token} from 'micromark-util-types'
|
|
*/
|
|
|
|
import {sanitizeUri} from 'micromark-util-sanitize-uri'
|
|
|
|
/**
|
|
* Create an HTML extension for `micromark` to support GitHub autolink literal
|
|
* when serializing to HTML.
|
|
*
|
|
* @returns {HtmlExtension}
|
|
* Extension for `micromark` that can be passed in `htmlExtensions` to
|
|
* support GitHub autolink literal when serializing to HTML.
|
|
*/
|
|
export function gfmAutolinkLiteralHtml() {
|
|
return {
|
|
exit: {literalAutolinkEmail, literalAutolinkHttp, literalAutolinkWww}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @this {CompileContext}
|
|
* @type {Handle}
|
|
*/
|
|
function literalAutolinkWww(token) {
|
|
anchorFromToken.call(this, token, 'http://')
|
|
}
|
|
|
|
/**
|
|
* @this {CompileContext}
|
|
* @type {Handle}
|
|
*/
|
|
function literalAutolinkEmail(token) {
|
|
anchorFromToken.call(this, token, 'mailto:')
|
|
}
|
|
|
|
/**
|
|
* @this {CompileContext}
|
|
* @type {Handle}
|
|
*/
|
|
function literalAutolinkHttp(token) {
|
|
anchorFromToken.call(this, token)
|
|
}
|
|
|
|
/**
|
|
* @this CompileContext
|
|
* @param {Token} token
|
|
* @param {string | null | undefined} [protocol]
|
|
* @returns {undefined}
|
|
*/
|
|
function anchorFromToken(token, protocol) {
|
|
const url = this.sliceSerialize(token)
|
|
this.tag('<a href="' + sanitizeUri((protocol || '') + url) + '">')
|
|
this.raw(this.encode(url))
|
|
this.tag('</a>')
|
|
}
|