How to use @shd101wyy/mume - 10 common examples

To help you get started, we’ve selected a few @shd101wyy/mume examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github donsheehy / datastructures / generatebook.js View on Github external
async function main() {
  await mume.init();

  const engine = new mume.MarkdownEngine({
    filePath: "./docs/fullbook.md",
    config: {
      previewTheme: "github-light.css",
      // revealjsTheme: "white.css"
      codeBlockTheme: "default.css",
      breakOnSingleNewLine: false,
      printBackground: true,
      enableScriptExecution: true, // <= for running code chunks
    },
  });

  // html export
  // await engine.htmlExport({ offline: false, runAllCodeChunks: true });
  // console.log("Should be done.");

  // chrome (puppeteer) export
github donsheehy / datastructures / generatebook.js View on Github external
async function main() {
  await mume.init();

  const engine = new mume.MarkdownEngine({
    filePath: "./docs/fullbook.md",
    config: {
      previewTheme: "github-light.css",
      // revealjsTheme: "white.css"
      codeBlockTheme: "default.css",
      breakOnSingleNewLine: false,
      printBackground: true,
      enableScriptExecution: true, // <= for running code chunks
    },
  });

  // html export
  // await engine.htmlExport({ offline: false, runAllCodeChunks: true });
  // console.log("Should be done.");
github shd101wyy / vscode-markdown-preview-enhanced / src / preview-content-provider.ts View on Github external
public constructor(private context: vscode.ExtensionContext) {
    this.config = MarkdownPreviewEnhancedConfig.getCurrentConfig();

    mume
      .init() // init markdown-preview-enhanced
      .then(() => {
        mume.onDidChangeConfigFile(this.refreshAllPreviews.bind(this));
        MarkdownEngine.onModifySource(this.modifySource.bind(this));

        const extensionVersion = require(path.resolve(
          this.context.extensionPath,
          "./package.json",
        ))["version"];
        if (extensionVersion !== mume.configs.config["vscode_mpe_version"]) {
          mume.utility.updateExtensionConfig({
            vscode_mpe_version: extensionVersion,
          });
        }
      });
  }
github shd101wyy / vscode-markdown-preview-enhanced / src / extension.ts View on Github external
function clickTagA(uri, href) {
    href = decodeURIComponent(href);
    href = href.replace(/^vscode\-resource:\/\/\//, "file:///");
    if (
      [".pdf", ".xls", ".xlsx", ".doc", ".ppt", ".docx", ".pptx"].indexOf(
        path.extname(href),
      ) >= 0
    ) {
      utility.openFile(href);
    } else if (href.match(/^file\:\/\/\//)) {
      // openFilePath = href.slice(8) # remove protocol
      let openFilePath = utility.addFileProtocol(
        href.replace(/(\s*)[\#\?](.+)$/, ""),
      ); // remove #anchor and ?params...
      openFilePath = decodeURI(openFilePath);
      vscode.commands.executeCommand(
        "vscode.open",
        vscode.Uri.parse(openFilePath),
        vscode.ViewColumn.One,
      );
    } else {
      utility.openFile(href);
    }
  }
github shd101wyy / vscode-markdown-preview-enhanced / src / extension.ts View on Github external
) >= 0
    ) {
      utility.openFile(href);
    } else if (href.match(/^file\:\/\/\//)) {
      // openFilePath = href.slice(8) # remove protocol
      let openFilePath = utility.addFileProtocol(
        href.replace(/(\s*)[\#\?](.+)$/, ""),
      ); // remove #anchor and ?params...
      openFilePath = decodeURI(openFilePath);
      vscode.commands.executeCommand(
        "vscode.open",
        vscode.Uri.parse(openFilePath),
        vscode.ViewColumn.One,
      );
    } else {
      utility.openFile(href);
    }
  }
github shd101wyy / vscode-markdown-preview-enhanced / src / image-helper.ts View on Github external
const hint = `![Uploading ${imageFileName}… (${uid})]()`;
      const curPos = editor.selection.active;

      editor.edit((textEditorEdit) => {
        textEditorEdit.insert(curPos, hint);
      });

      const config = vscode.workspace.getConfiguration(
        "markdown-preview-enhanced",
      );
      const AccessKey = config.get("AccessKey") || "";
      const SecretKey = config.get("SecretKey") || "";
      const Bucket = config.get("Bucket") || "";
      const Domain = config.get("Domain") || "";

      utility
        .uploadImage(imageFilePath, {
          method: imageUploader,
          qiniu: { AccessKey, SecretKey, Bucket, Domain },
        })
        .then((url) => {
          setUploadedImageURL(imageFileName, url, editor, hint, curPos);
        })
        .catch((error) => {
          vscode.window.showErrorMessage(error.toString());
        });
    });
}
github shd101wyy / vscode-markdown-preview-enhanced / src / extension.ts View on Github external
function openMathJaxConfig() {
    const mathjaxConfigFilePath = utility.addFileProtocol(
      path.resolve(utility.extensionConfigDirectoryPath, "./mathjax_config.js"),
    );
    vscode.commands.executeCommand(
      "vscode.open",
      vscode.Uri.parse(mathjaxConfigFilePath),
    );
  }
github shd101wyy / vscode-markdown-preview-enhanced / src / extension.ts View on Github external
function openKaTeXConfig() {
    const katexConfigFilePath = utility.addFileProtocol(
      path.resolve(utility.extensionConfigDirectoryPath, "./katex_config.js"),
    );
    vscode.commands.executeCommand(
      "vscode.open",
      vscode.Uri.parse(katexConfigFilePath),
    );
  }
github shd101wyy / vscode-markdown-preview-enhanced / src / extension.ts View on Github external
function extendParser() {
    const parserConfigPath = utility.addFileProtocol(
      path.resolve(utility.extensionConfigDirectoryPath, "./parser.js"),
    );
    vscode.commands.executeCommand(
      "vscode.open",
      vscode.Uri.parse(parserConfigPath),
    );
  }
github shd101wyy / vscode-markdown-preview-enhanced / src / extension.ts View on Github external
function openMermaidConfig() {
    const mermaidConfigFilePath = utility.addFileProtocol(
      path.resolve(utility.extensionConfigDirectoryPath, "./mermaid_config.js"),
    );
    vscode.commands.executeCommand(
      "vscode.open",
      vscode.Uri.parse(mermaidConfigFilePath),
    );
  }