Bhargava 6063bd1724 Help Project:
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.
2025-07-04 15:54:13 +05:30

60 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>');
}