forked from FINAKON/HelpProject
1. Initial Commit - a boiler plate code and POC to realize the concept of context sensitive help 2. Frontend code written in ReactJS 3. Backend code written in Java, Spring Boot Framework 4. Frontend Start: pre-requisites : node, npm npm run dev ==> to start the frontend vite server 5. Backend Start: pre-requisites : java, mvn mvn spring-boot:run ==> to start the backend server 6. Visit http://localhost:5173/ for basic demo of help, press F1 in textboxes 7. Visit http://localhost:5173/editor and enter "admin123" to add/modify texts. Happy Coding !!! Thank you, Bhargava.
34 lines
1.1 KiB
JavaScript
34 lines
1.1 KiB
JavaScript
/**
|
||
* @import {AssociationId} from '../types.js'
|
||
*/
|
||
|
||
import {decodeString} from 'micromark-util-decode-string'
|
||
|
||
/**
|
||
* Get an identifier from an association to match it to others.
|
||
*
|
||
* Associations are nodes that match to something else through an ID:
|
||
* <https://github.com/syntax-tree/mdast#association>.
|
||
*
|
||
* The `label` of an association is the string value: character escapes and
|
||
* references work, and casing is intact.
|
||
* The `identifier` is used to match one association to another:
|
||
* controversially, character escapes and references don’t work in this
|
||
* matching: `©` does not match `©`, and `\+` does not match `+`.
|
||
*
|
||
* But casing is ignored (and whitespace) is trimmed and collapsed: ` A\nb`
|
||
* matches `a b`.
|
||
* So, we do prefer the label when figuring out how we’re going to serialize:
|
||
* it has whitespace, casing, and we can ignore most useless character
|
||
* escapes and all character references.
|
||
*
|
||
* @type {AssociationId}
|
||
*/
|
||
export function association(node) {
|
||
if (node.label || !node.identifier) {
|
||
return node.label || ''
|
||
}
|
||
|
||
return decodeString(node.identifier)
|
||
}
|