Open CharisLee opened 3 years ago
How to display the code block in mindmap?
Same here. Mind map wouldn't work if I specify coding language.
Same here, but I have found some workarounds (works with Mind Map 1.1.0) ;
Write :
```Bash
(with a capital B) ```Shell
(with a capital S) or ```sh
instead of
```shell
or ```bash
If you don't want to modify all your code block headers ;
.obsidian/plugins/obsidian-mind-map/main.js
loadLanguages
function (line 27077)return;
before const pathToLanguage = './prism-' + lang;
Original main.js at line 27077 :
function loadLanguages(languages) {
if (languages === undefined) {
languages = Object.keys(components_1.languages).filter(l => l != 'meta');
} else if (!Array.isArray(languages)) {
languages = [languages];
}
// the user might have loaded languages via some other way or used `prism.js` which already includes some
// we don't need to validate the ids because `getLoader` will ignore invalid ones
const loaded = [...loadedLanguages, ...Object.keys(Prism.languages)];
dependencies(components_1, languages, loaded).load(lang => {
if (!(lang in components_1.languages)) {
if (!loadLanguages.silent) {
console.warn('Language does not exist: ' + lang);
}
return;
}
const pathToLanguage = './prism-' + lang;
// remove from require cache and from Prism
delete require.cache[require.resolve(pathToLanguage)];
delete Prism.languages[lang];
commonjsRequire();
loadedLanguages.add(lang);
});
}
Modified main.js at line 27077 :
function loadLanguages(languages) {
if (languages === undefined) {
languages = Object.keys(components_1.languages).filter(l => l != 'meta');
} else if (!Array.isArray(languages)) {
languages = [languages];
}
// the user might have loaded languages via some other way or used `prism.js` which already includes some
// we don't need to validate the ids because `getLoader` will ignore invalid ones
const loaded = [...loadedLanguages, ...Object.keys(Prism.languages)];
dependencies(components_1, languages, loaded).load(lang => {
if (!(lang in components_1.languages)) {
if (!loadLanguages.silent) {
console.warn('Language does not exist: ' + lang);
}
return;
}
return; // <-- ADD THIS
const pathToLanguage = './prism-' + lang;
// remove from require cache and from Prism
delete require.cache[global.require.resolve(pathToLanguage)];
delete Prism.languages[lang];
commonjsRequire();
loadedLanguages.add(lang);
});
}
I think this issue as something to do with the Prismjs module
Great
```shell 123456 ``` the mindmap will not work `
`html 123456 \
`` the mindmap will be normalIn order to highlight the code, I must use shell to announce the code block
Had anybody encountered the same problem?