- CodiMD
+ HedgeDoc
diff --git a/src/components/landing-layout/footer/powered-by-links.tsx b/src/components/landing-layout/footer/powered-by-links.tsx
index c3cc7195d..1672ebf3b 100644
--- a/src/components/landing-layout/footer/powered-by-links.tsx
+++ b/src/components/landing-layout/footer/powered-by-links.tsx
@@ -15,7 +15,7 @@ export const PoweredByLinks: React.FC = () => {
return (
-
+
|
diff --git a/src/components/landing-layout/footer/social-links.tsx b/src/components/landing-layout/footer/social-links.tsx
index 6d2351b8e..c8bff8f8d 100644
--- a/src/components/landing-layout/footer/social-links.tsx
+++ b/src/components/landing-layout/footer/social-links.tsx
@@ -9,7 +9,7 @@ const SocialLink: React.FC = () => {
,
,
- ,
+ ,
,
]}/>
diff --git a/src/components/markdown-renderer/markdown-it-plugins/line-number-marker.ts b/src/components/markdown-renderer/markdown-it-plugins/line-number-marker.ts
index 68330885a..d636709dd 100644
--- a/src/components/markdown-renderer/markdown-it-plugins/line-number-marker.ts
+++ b/src/components/markdown-renderer/markdown-it-plugins/line-number-marker.ts
@@ -16,7 +16,7 @@ export interface LineNumberMarkerOptions {
*/
export const lineNumberMarker: () => MarkdownIt.PluginWithOptions = () => {
return (md: MarkdownIt, options) => {
- // add codimd_linemarker token before each opening or self-closing level-0 tag
+ // add app_linemarker token before each opening or self-closing level-0 tag
md.core.ruler.push('line_number_marker', (state) => {
const lineMarkers: LineMarkers[] = []
tagTokens(state.tokens, lineMarkers)
@@ -26,7 +26,7 @@ export const lineNumberMarker: () => MarkdownIt.PluginWithOptions {
+ md.renderer.rules.app_linemarker = (tokens: Token[], index: number): string => {
const startLineNumber = tokens[index].attrGet('data-start-line')
const endLineNumber = tokens[index].attrGet('data-end-line')
@@ -35,11 +35,11 @@ export const lineNumberMarker: () => MarkdownIt.PluginWithOptions`
+ return ``
}
const insertNewLineMarker = (startLineNumber: number, endLineNumber: number, tokenPosition: number, level: number, tokens: Token[]) => {
- const startToken = new Token('codimd_linemarker', 'codimd-linemarker', 0)
+ const startToken = new Token('app_linemarker', 'app-linemarker', 0)
startToken.level = level
startToken.attrPush(['data-start-line', `${startLineNumber}`])
startToken.attrPush(['data-end-line', `${endLineNumber}`])
diff --git a/src/components/markdown-renderer/markdown-renderer.tsx b/src/components/markdown-renderer/markdown-renderer.tsx
index 3e825cb03..bf147821e 100644
--- a/src/components/markdown-renderer/markdown-renderer.tsx
+++ b/src/components/markdown-renderer/markdown-renderer.tsx
@@ -54,7 +54,7 @@ import { replaceVimeoLink } from './regex-plugins/replace-vimeo-link'
import { replaceYouTubeLink } from './regex-plugins/replace-youtube-link'
import { buildTransformer, calculateNewLineNumberMapping, LineKeys } from './renderer-utils'
import { AsciinemaReplacer } from './replace-components/asciinema/asciinema-replacer'
-import { CodimdLinemarkerReplacer } from './replace-components/codimd-linemarker/codimd-linemarker-replacer'
+import { LinemarkerReplacer } from './replace-components/linemarker/linemarker-replacer'
import { ComponentReplacer } from './replace-components/ComponentReplacer'
import { CsvReplacer } from './replace-components/csv/csv-replacer'
import { FlowchartReplacer } from './replace-components/flow/flowchart-replacer'
@@ -281,12 +281,12 @@ export const MarkdownRenderer: React.FC = ({
permalinkSymbol: ''
})
md.use(mathJax({
- beforeMath: '',
- afterMath: '',
- beforeInlineMath: '',
- afterInlineMath: '',
- beforeDisplayMath: '',
- afterDisplayMath: ''
+ beforeMath: '',
+ afterMath: '',
+ beforeInlineMath: '',
+ afterInlineMath: '',
+ beforeDisplayMath: '',
+ afterDisplayMath: ''
}))
md.use(markdownItRegex, replaceLegacyYoutubeShortCode)
md.use(markdownItRegex, replaceLegacyVimeoShortCode)
@@ -339,7 +339,7 @@ export const MarkdownRenderer: React.FC = ({
const markdownReactDom: ReactElement[] = useMemo(() => {
const allReplacers: ComponentReplacer[] = [
- new CodimdLinemarkerReplacer(),
+ new LinemarkerReplacer(),
new PossibleWiderReplacer(),
new GistReplacer(),
new YoutubeReplacer(),
diff --git a/src/components/markdown-renderer/regex-plugins/replace-asciinema-link.ts b/src/components/markdown-renderer/regex-plugins/replace-asciinema-link.ts
index c334e949f..5a5ea3ba3 100644
--- a/src/components/markdown-renderer/regex-plugins/replace-asciinema-link.ts
+++ b/src/components/markdown-renderer/regex-plugins/replace-asciinema-link.ts
@@ -13,6 +13,6 @@ export const replaceAsciinemaLink: RegexOptions = {
replace: (match) => {
// ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
// noinspection CheckTagEmptyBody
- return ``
+ return ``
}
}
diff --git a/src/components/markdown-renderer/regex-plugins/replace-gist-link.ts b/src/components/markdown-renderer/regex-plugins/replace-gist-link.ts
index 9dba99ed9..0a1a1e552 100644
--- a/src/components/markdown-renderer/regex-plugins/replace-gist-link.ts
+++ b/src/components/markdown-renderer/regex-plugins/replace-gist-link.ts
@@ -13,6 +13,6 @@ export const replaceGistLink: RegexOptions = {
replace: (match) => {
// ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
// noinspection CheckTagEmptyBody
- return ``
+ return ``
}
}
diff --git a/src/components/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts
index 06471d677..c76ec666d 100644
--- a/src/components/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts
+++ b/src/components/markdown-renderer/regex-plugins/replace-legacy-gist-short-code.ts
@@ -8,6 +8,6 @@ export const replaceLegacyGistShortCode: RegexOptions = {
replace: (match) => {
// ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
// noinspection CheckTagEmptyBody
- return ``
+ return ``
}
}
diff --git a/src/components/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts
index ed77b411b..9c069d6b8 100644
--- a/src/components/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts
+++ b/src/components/markdown-renderer/regex-plugins/replace-legacy-vimeo-short-code.ts
@@ -6,6 +6,6 @@ export const replaceLegacyVimeoShortCode: RegexOptions = {
replace: (match) => {
// ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
// noinspection CheckTagEmptyBody
- return ``
+ return ``
}
}
diff --git a/src/components/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts
index 2cbc50417..87aa345b1 100644
--- a/src/components/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts
+++ b/src/components/markdown-renderer/regex-plugins/replace-legacy-youtube-short-code.ts
@@ -6,6 +6,6 @@ export const replaceLegacyYoutubeShortCode: RegexOptions = {
replace: (match) => {
// ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
// noinspection CheckTagEmptyBody
- return ``
+ return ``
}
}
diff --git a/src/components/markdown-renderer/regex-plugins/replace-pdf-short-code.ts b/src/components/markdown-renderer/regex-plugins/replace-pdf-short-code.ts
index be8f3289e..a851feb66 100644
--- a/src/components/markdown-renderer/regex-plugins/replace-pdf-short-code.ts
+++ b/src/components/markdown-renderer/regex-plugins/replace-pdf-short-code.ts
@@ -6,6 +6,6 @@ export const replacePdfShortCode: RegexOptions = {
replace: (match) => {
// ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
// noinspection CheckTagEmptyBody
- return ``
+ return ``
}
}
diff --git a/src/components/markdown-renderer/regex-plugins/replace-vimeo-link.ts b/src/components/markdown-renderer/regex-plugins/replace-vimeo-link.ts
index bf126dc76..db363d294 100644
--- a/src/components/markdown-renderer/regex-plugins/replace-vimeo-link.ts
+++ b/src/components/markdown-renderer/regex-plugins/replace-vimeo-link.ts
@@ -13,6 +13,6 @@ export const replaceVimeoLink: RegexOptions = {
replace: (match) => {
// ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
// noinspection CheckTagEmptyBody
- return ``
+ return ``
}
}
diff --git a/src/components/markdown-renderer/regex-plugins/replace-youtube-link.ts b/src/components/markdown-renderer/regex-plugins/replace-youtube-link.ts
index 6f51fe360..1b509e2da 100644
--- a/src/components/markdown-renderer/regex-plugins/replace-youtube-link.ts
+++ b/src/components/markdown-renderer/regex-plugins/replace-youtube-link.ts
@@ -14,6 +14,6 @@ export const replaceYouTubeLink: RegexOptions = {
replace: (match) => {
// ESLint wants to collapse this tag, but then the tag won't be valid html anymore.
// noinspection CheckTagEmptyBody
- return ``
+ return ``
}
}
diff --git a/src/components/markdown-renderer/replace-components/asciinema/asciinema-replacer.tsx b/src/components/markdown-renderer/replace-components/asciinema/asciinema-replacer.tsx
index 5ceb80bc5..e0baed912 100644
--- a/src/components/markdown-renderer/replace-components/asciinema/asciinema-replacer.tsx
+++ b/src/components/markdown-renderer/replace-components/asciinema/asciinema-replacer.tsx
@@ -1,6 +1,6 @@
import { DomElement } from 'domhandler'
import React from 'react'
-import { getAttributesFromCodiMdTag } from '../codi-md-tag-utils'
+import { getAttributesFromHedgeDocTag } from '../utils'
import { ComponentReplacer } from '../ComponentReplacer'
import { AsciinemaFrame } from './asciinema-frame'
@@ -8,7 +8,7 @@ export class AsciinemaReplacer extends ComponentReplacer {
private counterMap: Map = new Map()
public getReplacement (node: DomElement, index: number): React.ReactElement | undefined {
- const attributes = getAttributesFromCodiMdTag(node, 'asciinema')
+ const attributes = getAttributesFromHedgeDocTag(node, 'asciinema')
if (attributes && attributes.id) {
const asciinemaId = attributes.id
const count = (this.counterMap.get(asciinemaId) || 0) + 1
diff --git a/src/components/markdown-renderer/replace-components/codi-md-tag-utils.ts b/src/components/markdown-renderer/replace-components/codi-md-tag-utils.ts
deleted file mode 100644
index 0dcd1cafa..000000000
--- a/src/components/markdown-renderer/replace-components/codi-md-tag-utils.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-import { DomElement } from 'domhandler'
-
-export const getAttributesFromCodiMdTag = (node: DomElement, tagName: string): ({ [s: string]: string; }|undefined) => {
- if (node.name !== `codimd-${tagName}` || !node.attribs) {
- return
- }
- return node.attribs
-}
diff --git a/src/components/markdown-renderer/replace-components/gist/gist-replacer.tsx b/src/components/markdown-renderer/replace-components/gist/gist-replacer.tsx
index 791e4b807..0039182db 100644
--- a/src/components/markdown-renderer/replace-components/gist/gist-replacer.tsx
+++ b/src/components/markdown-renderer/replace-components/gist/gist-replacer.tsx
@@ -1,6 +1,6 @@
import { DomElement } from 'domhandler'
import React from 'react'
-import { getAttributesFromCodiMdTag } from '../codi-md-tag-utils'
+import { getAttributesFromHedgeDocTag } from '../utils'
import { ComponentReplacer } from '../ComponentReplacer'
import { OneClickEmbedding } from '../one-click-frame/one-click-embedding'
import { GistFrame } from './gist-frame'
@@ -10,7 +10,7 @@ export class GistReplacer extends ComponentReplacer {
private counterMap: Map = new Map()
public getReplacement (node: DomElement, index: number): React.ReactElement | undefined {
- const attributes = getAttributesFromCodiMdTag(node, 'gist')
+ const attributes = getAttributesFromHedgeDocTag(node, 'gist')
if (attributes && attributes.id) {
const gistId = attributes.id
const count = (this.counterMap.get(gistId) || 0) + 1
diff --git a/src/components/markdown-renderer/replace-components/katex/katex-replacer.tsx b/src/components/markdown-renderer/replace-components/katex/katex-replacer.tsx
index 1d0b96c75..210756805 100644
--- a/src/components/markdown-renderer/replace-components/katex/katex-replacer.tsx
+++ b/src/components/markdown-renderer/replace-components/katex/katex-replacer.tsx
@@ -9,12 +9,12 @@ const getNodeIfKatexBlock = (node: DomElement): (DomElement|undefined) => {
return
}
return node.children.find((subnode) => {
- return (subnode.name === 'codimd-katex' && subnode.attribs?.inline === undefined)
+ return (subnode.name === 'app-katex' && subnode.attribs?.inline === undefined)
})
}
const getNodeIfInlineKatex = (node: DomElement): (DomElement|undefined) => {
- return (node.name === 'codimd-katex' && node.attribs?.inline !== undefined) ? node : undefined
+ return (node.name === 'app-katex' && node.attribs?.inline !== undefined) ? node : undefined
}
export class KatexReplacer extends ComponentReplacer {
diff --git a/src/components/markdown-renderer/replace-components/codimd-linemarker/codimd-linemarker-replacer.tsx b/src/components/markdown-renderer/replace-components/linemarker/linemarker-replacer.tsx
similarity index 79%
rename from src/components/markdown-renderer/replace-components/codimd-linemarker/codimd-linemarker-replacer.tsx
rename to src/components/markdown-renderer/replace-components/linemarker/linemarker-replacer.tsx
index 43bb63fca..45b67a7b4 100644
--- a/src/components/markdown-renderer/replace-components/codimd-linemarker/codimd-linemarker-replacer.tsx
+++ b/src/components/markdown-renderer/replace-components/linemarker/linemarker-replacer.tsx
@@ -1,7 +1,7 @@
import { DomElement } from 'domhandler'
import { ComponentReplacer } from '../ComponentReplacer'
-export class CodimdLinemarkerReplacer extends ComponentReplacer {
+export class LinemarkerReplacer extends ComponentReplacer {
public getReplacement (codeNode: DomElement, index: number): null | undefined {
return codeNode.name === 'codimd-linemarker' ? null : undefined
}
diff --git a/src/components/markdown-renderer/replace-components/pdf/pdf-replacer.tsx b/src/components/markdown-renderer/replace-components/pdf/pdf-replacer.tsx
index 93cf8c39e..0c597d3c1 100644
--- a/src/components/markdown-renderer/replace-components/pdf/pdf-replacer.tsx
+++ b/src/components/markdown-renderer/replace-components/pdf/pdf-replacer.tsx
@@ -1,6 +1,6 @@
import { DomElement } from 'domhandler'
import React from 'react'
-import { getAttributesFromCodiMdTag } from '../codi-md-tag-utils'
+import { getAttributesFromHedgeDocTag } from '../utils'
import { ComponentReplacer } from '../ComponentReplacer'
import { PdfFrame } from './pdf-frame'
@@ -8,7 +8,7 @@ export class PdfReplacer extends ComponentReplacer {
private counterMap: Map = new Map()
public getReplacement (node: DomElement, index: number): React.ReactElement | undefined {
- const attributes = getAttributesFromCodiMdTag(node, 'pdf')
+ const attributes = getAttributesFromHedgeDocTag(node, 'pdf')
if (attributes && attributes.url) {
const pdfUrl = attributes.url
const count = (this.counterMap.get(pdfUrl) || 0) + 1
diff --git a/src/components/markdown-renderer/replace-components/possible-wider/possible-wider-replacer.tsx b/src/components/markdown-renderer/replace-components/possible-wider/possible-wider-replacer.tsx
index 8cd02e7c6..eb3b2d898 100644
--- a/src/components/markdown-renderer/replace-components/possible-wider/possible-wider-replacer.tsx
+++ b/src/components/markdown-renderer/replace-components/possible-wider/possible-wider-replacer.tsx
@@ -2,7 +2,7 @@ import { DomElement } from 'domhandler'
import { ComponentReplacer, NativeRenderer, SubNodeTransform } from '../ComponentReplacer'
import './possible-wider-replacer.scss'
-const enabledTags = ['img', 'codimd-youtube', 'codimd-vimeo', 'codimd-asciinema', 'codimd-pdf']
+const enabledTags = ['img', 'app-youtube', 'app-vimeo', 'app-asciinema', 'app-pdf']
/**
* This replacer doesn't actually replace something.
diff --git a/src/components/markdown-renderer/replace-components/utils.ts b/src/components/markdown-renderer/replace-components/utils.ts
new file mode 100644
index 000000000..1c5b16e31
--- /dev/null
+++ b/src/components/markdown-renderer/replace-components/utils.ts
@@ -0,0 +1,8 @@
+import { DomElement } from 'domhandler'
+
+export const getAttributesFromHedgeDocTag = (node: DomElement, tagName: string): ({ [s: string]: string; }|undefined) => {
+ if (node.name !== `app-${tagName}` || !node.attribs) {
+ return
+ }
+ return node.attribs
+}
diff --git a/src/components/markdown-renderer/replace-components/vimeo/vimeo-replacer.tsx b/src/components/markdown-renderer/replace-components/vimeo/vimeo-replacer.tsx
index 98ddecbea..747824c48 100644
--- a/src/components/markdown-renderer/replace-components/vimeo/vimeo-replacer.tsx
+++ b/src/components/markdown-renderer/replace-components/vimeo/vimeo-replacer.tsx
@@ -1,6 +1,6 @@
import { DomElement } from 'domhandler'
import React from 'react'
-import { getAttributesFromCodiMdTag } from '../codi-md-tag-utils'
+import { getAttributesFromHedgeDocTag } from '../utils'
import { ComponentReplacer } from '../ComponentReplacer'
import { VimeoFrame } from './vimeo-frame'
@@ -8,7 +8,7 @@ export class VimeoReplacer extends ComponentReplacer {
private counterMap: Map = new Map()
public getReplacement (node: DomElement, index: number): React.ReactElement | undefined {
- const attributes = getAttributesFromCodiMdTag(node, 'vimeo')
+ const attributes = getAttributesFromHedgeDocTag(node, 'vimeo')
if (attributes && attributes.id) {
const videoId = attributes.id
const count = (this.counterMap.get(videoId) || 0) + 1
diff --git a/src/components/markdown-renderer/replace-components/youtube/youtube-replacer.tsx b/src/components/markdown-renderer/replace-components/youtube/youtube-replacer.tsx
index 696af7dd1..997ea2986 100644
--- a/src/components/markdown-renderer/replace-components/youtube/youtube-replacer.tsx
+++ b/src/components/markdown-renderer/replace-components/youtube/youtube-replacer.tsx
@@ -1,6 +1,6 @@
import { DomElement } from 'domhandler'
import React from 'react'
-import { getAttributesFromCodiMdTag } from '../codi-md-tag-utils'
+import { getAttributesFromHedgeDocTag } from '../utils'
import { ComponentReplacer } from '../ComponentReplacer'
import { YouTubeFrame } from './youtube-frame'
@@ -8,7 +8,7 @@ export class YoutubeReplacer extends ComponentReplacer {
private counterMap: Map = new Map()
public getReplacement (node: DomElement, index: number): React.ReactElement | undefined {
- const attributes = getAttributesFromCodiMdTag(node, 'youtube')
+ const attributes = getAttributesFromHedgeDocTag(node, 'youtube')
if (attributes && attributes.id) {
const videoId = attributes.id
const count = (this.counterMap.get(videoId) || 0) + 1