@meith/markdown 0.21.2 → 0.23.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/attribution.ts +0 -5
- package/src/quote.ts +0 -2
package/package.json
CHANGED
package/src/attribution.ts
CHANGED
|
@@ -3,7 +3,6 @@ import { textOf } from './nodes'
|
|
|
3
3
|
|
|
4
4
|
const ATTRIBUTION = /^(.+) wrote:$/
|
|
5
5
|
|
|
6
|
-
/** `/member/by-name/ada`, encoded so a name cannot close a Markdown link. */
|
|
7
6
|
export function memberByNameHref(name: string): string {
|
|
8
7
|
const encoded = encodeURIComponent(name.trim()).replace(
|
|
9
8
|
/[!'()*]/g,
|
|
@@ -14,11 +13,9 @@ export function memberByNameHref(name: string): string {
|
|
|
14
13
|
|
|
15
14
|
export interface AttributedAuthor {
|
|
16
15
|
readonly name: string
|
|
17
|
-
/** The profile the name links to, or `null` for a bare name. */
|
|
18
16
|
readonly href: string | null
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
/** The author named by a `**… wrote:**` run: a bare name, or a linked one. */
|
|
22
19
|
export function attributedAuthor(node: Inline): AttributedAuthor | null {
|
|
23
20
|
if (node.kind !== 'strong') return null
|
|
24
21
|
|
|
@@ -40,12 +37,10 @@ export function attributedAuthor(node: Inline): AttributedAuthor | null {
|
|
|
40
37
|
}
|
|
41
38
|
|
|
42
39
|
export interface QuoteAttribution extends AttributedAuthor {
|
|
43
|
-
/** The quoted post, so a reader can go and read the rest of it. */
|
|
44
40
|
readonly sourceHref: string | null
|
|
45
41
|
readonly sourceLabel: string
|
|
46
42
|
}
|
|
47
43
|
|
|
48
|
-
/** A quote's opening paragraph, when it is only an attribution. */
|
|
49
44
|
export function quoteAttribution(block: Block | undefined): QuoteAttribution | null {
|
|
50
45
|
if (block === undefined || block.kind !== 'paragraph') return null
|
|
51
46
|
|
package/src/quote.ts
CHANGED
|
@@ -3,9 +3,7 @@ import { plainAuthorName } from './escape-source'
|
|
|
3
3
|
|
|
4
4
|
export interface QuoteInput {
|
|
5
5
|
readonly author?: string | null
|
|
6
|
-
/** Defaults to the author's profile; `null` leaves the name as plain text. */
|
|
7
6
|
readonly authorHref?: string | null
|
|
8
|
-
/** The post being quoted, written into the quote as a link back to it. */
|
|
9
7
|
readonly sourceHref?: string | null
|
|
10
8
|
readonly sourceLabel?: string
|
|
11
9
|
readonly markdown: string
|