mirror of
				https://github.com/Xahau/xahau-web.git
				synced 2025-11-04 04:15:47 +00:00 
			
		
		
		
	add references
This commit is contained in:
		@@ -1,2 +1,9 @@
 | 
			
		||||
<!-- Currently, remarkPlugins does not support HMR, so you will need to restart the dev server if you change this file. -->
 | 
			
		||||
[Internal Type]: /docs/protocol-reference/binary-format
 | 
			
		||||
[Sequence Number]: /docs/protocol-reference/data-types/#account-sequence
 | 
			
		||||
[Index Number]: /docs/protocol-reference/data-types/#index-number
 | 
			
		||||
[SHA-512Half]: /docs/protocol-reference/data-types/#hashes
 | 
			
		||||
[Specifying Time]: /docs/protocol-reference/data-types/#specifying-time
 | 
			
		||||
[seconds since the Ripple Epoch]: /docs/protocol-reference/data-types/#specifying-time
 | 
			
		||||
[Ledger Index]: /docs/protocol-reference/data-types/#ledger-index
 | 
			
		||||
[ledger index]: /docs/protocol-reference/data-types/#ledger-index
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										5
									
								
								src/content/references/pseudo-transactions.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										5
									
								
								src/content/references/pseudo-transactions.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,5 @@
 | 
			
		||||
EnableAmendment
 | 
			
		||||
EmitFailure
 | 
			
		||||
SetFee
 | 
			
		||||
UNLModify
 | 
			
		||||
UNLReport
 | 
			
		||||
							
								
								
									
										38
									
								
								src/content/references/transactions.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										38
									
								
								src/content/references/transactions.md
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,38 @@
 | 
			
		||||
AccountDelete
 | 
			
		||||
AccountSet
 | 
			
		||||
CheckCancel
 | 
			
		||||
CheckCash
 | 
			
		||||
CheckCreate
 | 
			
		||||
ClaimReward
 | 
			
		||||
Clawback
 | 
			
		||||
DepositPreauth
 | 
			
		||||
EscrowCancel
 | 
			
		||||
EscrowCreate
 | 
			
		||||
EscrowFinish
 | 
			
		||||
GenesisMint
 | 
			
		||||
Import
 | 
			
		||||
Invoke
 | 
			
		||||
NFTokenAcceptOffer
 | 
			
		||||
NFTokenBurn
 | 
			
		||||
NFTokenCancelOffer
 | 
			
		||||
NFTokenCreateOffer
 | 
			
		||||
NFTokenMint
 | 
			
		||||
OfferCancel
 | 
			
		||||
OfferCreate
 | 
			
		||||
Payment
 | 
			
		||||
PaymentChannelClaim
 | 
			
		||||
PaymentChannelCreate
 | 
			
		||||
PaymentChannelFund
 | 
			
		||||
Remit
 | 
			
		||||
SetHook
 | 
			
		||||
SetRegularKey
 | 
			
		||||
SetRemarks
 | 
			
		||||
SignerListSet
 | 
			
		||||
SpinalTap
 | 
			
		||||
TicketCreate
 | 
			
		||||
TrustSet
 | 
			
		||||
URITokenBurn
 | 
			
		||||
URITokenBuy
 | 
			
		||||
URITokenCancelSellOffer
 | 
			
		||||
URITokenCreateSellOffer
 | 
			
		||||
URITokenMint
 | 
			
		||||
@@ -1,7 +1,59 @@
 | 
			
		||||
import { readFileSync } from 'node:fs'
 | 
			
		||||
import { join } from 'node:path'
 | 
			
		||||
import { visit } from 'unist-util-visit'
 | 
			
		||||
 | 
			
		||||
const parseRules: {
 | 
			
		||||
  path: string
 | 
			
		||||
  parse: (content: string) => { label: string; url: string }[]
 | 
			
		||||
}[] = [
 | 
			
		||||
    {
 | 
			
		||||
      path: 'src/content/references/global.md',
 | 
			
		||||
      parse: (content: string) => {
 | 
			
		||||
        const lines = content.split('\n')
 | 
			
		||||
        const result: { label: string; url: string }[] = []
 | 
			
		||||
        for (const line of lines) {
 | 
			
		||||
          const match = line.match(/^\[([^\]]+)\]:\s*(.+)$/)
 | 
			
		||||
          if (match) {
 | 
			
		||||
            const [, label, url] = match
 | 
			
		||||
            result.push({ label, url: url.trim() })
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        return result
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      path: 'src/content/references/transactions.md',
 | 
			
		||||
      parse: (content: string) => {
 | 
			
		||||
        const lines = content.split('\n')
 | 
			
		||||
        const result: { label: string; url: string }[] = []
 | 
			
		||||
        for (const line of lines) {
 | 
			
		||||
          if (line.length > 0) {
 | 
			
		||||
            const url = `/docs/protocol-reference/transactions/transaction-types/${line.toLowerCase()}`
 | 
			
		||||
            result.push({ label: `${line}`, url })
 | 
			
		||||
            result.push({ label: `${line} transaction`, url })
 | 
			
		||||
            result.push({ label: `${line} transactions`, url })
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        return result
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      path: 'src/content/references/pseudo-transactions.md',
 | 
			
		||||
      parse: (content: string) => {
 | 
			
		||||
        const lines = content.split('\n')
 | 
			
		||||
        const result: { label: string; url: string }[] = []
 | 
			
		||||
        for (const line of lines) {
 | 
			
		||||
          if (line.length > 0) {
 | 
			
		||||
            const url = `/docs/protocol-reference/transactions/pseudo-transaction-types/${line.toLowerCase()}`
 | 
			
		||||
            result.push({ label: `${line}`, url })
 | 
			
		||||
            result.push({ label: `${line} transaction`, url })
 | 
			
		||||
            result.push({ label: `${line} transactions`, url })
 | 
			
		||||
          }
 | 
			
		||||
        }
 | 
			
		||||
        return result
 | 
			
		||||
      },
 | 
			
		||||
    },
 | 
			
		||||
  ]
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Remark plugin to resolve reference-style links from global.md
 | 
			
		||||
 */
 | 
			
		||||
@@ -12,25 +64,15 @@ export function remarkGlobalReferences() {
 | 
			
		||||
    if (globalRefs !== null) return globalRefs
 | 
			
		||||
 | 
			
		||||
    try {
 | 
			
		||||
      const globalMdPath = join(
 | 
			
		||||
        process.cwd(),
 | 
			
		||||
        'src/content/references/global.md',
 | 
			
		||||
      )
 | 
			
		||||
      const content = readFileSync(globalMdPath, 'utf-8')
 | 
			
		||||
 | 
			
		||||
      globalRefs = {}
 | 
			
		||||
 | 
			
		||||
      // Parse reference-style link definitions: [label]: url
 | 
			
		||||
      const lines = content.split('\n')
 | 
			
		||||
      for (const line of lines) {
 | 
			
		||||
        const match = line.match(/^\[([^\]]+)\]:\s*(.+)$/)
 | 
			
		||||
        if (match) {
 | 
			
		||||
          const [, label, url] = match
 | 
			
		||||
          globalRefs[label] = url.trim()
 | 
			
		||||
      for (const rule of parseRules) {
 | 
			
		||||
        const content = readFileSync(rule.path, 'utf-8')
 | 
			
		||||
        const refs = rule.parse(content)
 | 
			
		||||
        for (const ref of refs) {
 | 
			
		||||
          globalRefs[ref.label] = ref.url
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      console.log('Loaded global references:', globalRefs)
 | 
			
		||||
      return globalRefs
 | 
			
		||||
    } catch (error: any) {
 | 
			
		||||
      console.warn('Could not load global.md references:', error.message)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user