@@ -57,6 +58,7 @@ import { ScrollableOverlayDirective } from '../../shared/overlay-scrollbar/scrol
(fileSelected)="noteSelected.emit($event)"
(tagSelected)="onTagSelected($event)"
(quickLinkSelected)="onQuickLink($event)"
+ (markdownPlaygroundSelected)="onMarkdownPlaygroundSelected()"
/>
@@ -117,7 +119,8 @@ import { ScrollableOverlayDirective } from '../../shared/overlay-scrollbar/scrol
-
+ ();
@Output() tagClicked = new EventEmitter();
@@ -213,6 +217,7 @@ export class AppShellNimbusLayoutComponent {
@Output() navigateHeading = new EventEmitter();
@Output() searchTermChange = new EventEmitter();
@Output() searchOptionsChange = new EventEmitter();
+ @Output() markdownPlaygroundSelected = new EventEmitter();
folderFilter: string | null = null;
listQuery: string = '';
@@ -303,4 +308,8 @@ export class AppShellNimbusLayoutComponent {
this.flyoutCloseTimer = null;
}
}
+
+ onMarkdownPlaygroundSelected(): void {
+ this.markdownPlaygroundSelected.emit();
+ }
}
diff --git a/src/assets/samples/markdown-playground.md b/src/assets/samples/markdown-playground.md
new file mode 100644
index 0000000..e5ebe73
--- /dev/null
+++ b/src/assets/samples/markdown-playground.md
@@ -0,0 +1,129 @@
+# Titre H1
+## Titre H2
+### Titre H3
+
+**Gras**, *Italique*, ~~Barré~~, `inline code`, [lien externe](https://example.com)
+
+> Blockquote / Citation
+> Peut s'étendre sur plusieurs lignes
+
+> [!NOTE]
+> Callout de type NOTE
+
+> [!WARNING]
+> Callout de type WARNING
+
+> [!TIP]
+> Callout de type TIP
+
+## Listes
+
+- Liste non ordonnée
+- Deuxième élément
+ - Sous-élément
+- Troisième élément
+
+1. Liste ordonnée
+2. Deuxième élément
+3. Troisième élément
+
+## Tâches
+
+- [ ] Tâche non cochée
+- [x] Tâche cochée
+- [ ] Autre tâche en attente
+
+## Code
+
+```typescript
+function hello(name: string): string {
+ return `Hello ${name}!`;
+}
+
+const result = hello("World");
+console.log(result);
+```
+
+```javascript
+const data = [1, 2, 3, 4, 5];
+const doubled = data.map(x => x * 2);
+console.log(doubled);
+```
+
+```python
+def fibonacci(n):
+ if n <= 1:
+ return n
+ return fibonacci(n-1) + fibonacci(n-2)
+
+print(fibonacci(10))
+```
+
+## Mermaid
+
+```mermaid
+graph TD
+ A[Start] --> B{Decision}
+ B -->|Yes| C[Action 1]
+ B -->|No| D[Action 2]
+ C --> E[End]
+ D --> E
+```
+
+```mermaid
+sequenceDiagram
+ Alice->>John: Hello John, how are you?
+ John-->>Alice: Great!
+ Alice-)John: See you later!
+```
+
+## Math (LaTeX)
+
+Inline math: $E = mc^2$
+
+Block math:
+
+$$
+\frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
+$$
+
+$$
+\int_{0}^{\infty} e^{-x^2} dx = \frac{\sqrt{\pi}}{2}
+$$
+
+## Tableaux
+
+| Colonne 1 | Colonne 2 | Colonne 3 |
+|-----------|-----------|-----------|
+| A | B | C |
+| D | E | F |
+| G | H | I |
+
+## Images
+
+
+
+## Tags
+
+Les tags inline fonctionnent: #test #markdown #playground
+
+## Liens internes (WikiLinks)
+
+[[Note Example]] - Lien vers une note
+[[Note Example#Section]] - Lien vers une section
+[[Note Example|Alias personnalisé]] - Lien avec alias
+
+## Footnotes
+
+Voici un texte avec une note de bas de page[^1].
+
+Et une autre référence[^2].
+
+[^1]: Ceci est la première note de bas de page.
+[^2]: Ceci est la deuxième note de bas de page avec plus de détails.
+
+---
+
+## Séparateur horizontal
+
+Le séparateur ci-dessus est créé avec `---`
diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts
index f2a944c..0ff2d68 100644
--- a/src/environments/environment.prod.ts
+++ b/src/environments/environment.prod.ts
@@ -7,4 +7,7 @@
export const environment = {
production: true,
serviceURL: "/AuMenuManager",
+ features: {
+ showTestSection: false
+ }
};
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index ab34137..dafe0b7 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -8,4 +8,7 @@ export const environment = {
production: false,
serviceURL: "http://localhost:8080/AuMenuManager",
// serviceURL: "https://public-tomcat.guru.lan/AuMenuManager",
+ features: {
+ showTestSection: true
+ }
};
\ No newline at end of file
diff --git a/src/services/markdown.service.ts b/src/services/markdown.service.ts
index 7ed7303..5c0bd5c 100644
--- a/src/services/markdown.service.ts
+++ b/src/services/markdown.service.ts
@@ -379,6 +379,25 @@ export class MarkdownService {
return placeholder;
});
+ const codeBlockPlaceholders: { placeholder: string; content: string }[] = [];
+ const inlineCodePlaceholders: { placeholder: string; content: string }[] = [];
+
+ const stashSegments = (
+ source: string,
+ regex: RegExp,
+ collection: { placeholder: string; content: string }[],
+ marker: string
+ ): string => {
+ return source.replace(regex, (match) => {
+ const placeholder = `@@__${marker}_${collection.length}__@@`;
+ collection.push({ placeholder, content: match });
+ return placeholder;
+ });
+ };
+
+ text = stashSegments(text, /```[\s\S]*?```/g, codeBlockPlaceholders, 'CODE_BLOCK');
+ text = stashSegments(text, /`[^`]*`/g, inlineCodePlaceholders, 'CODE_INLINE');
+
const addMathPlaceholder = (expression: string, display: 'block' | 'inline') => {
const placeholder = `@@MATH::${display.toUpperCase()}::${math.length}@@`;
math.push({ placeholder, expression: expression.trim(), display });
@@ -395,6 +414,14 @@ export class MarkdownService {
text = text.replace(/(? addMathPlaceholder(expr, 'inline'));
text = text.replace(/\\\((.+?)\\\)/g, (_match, expr) => addMathPlaceholder(expr, 'inline'));
+ for (const { placeholder, content } of inlineCodePlaceholders) {
+ text = text.split(placeholder).join(content);
+ }
+
+ for (const { placeholder, content } of codeBlockPlaceholders) {
+ text = text.split(placeholder).join(content);
+ }
+
return { markdown: text, wikiLinks, math };
}