Giter Site home page Giter Site logo

Support md files about emojicodes HOT 8 OPEN

sphinx-contrib avatar sphinx-contrib commented on June 13, 2024 5
Support md files

from emojicodes.

Comments (8)

jdillard avatar jdillard commented on June 13, 2024 2

I'm not positive, but it seems the extension only parses .rst:

self.parser = self.app.registry.create_source_parser(self.app, 'rst')

where as it should support everything in source_suffix?

from emojicodes.

Peque avatar Peque commented on June 13, 2024

Thanks for your suggestion @meri-burgess! 😊

Could you elaborate a bit more on your use case? I'm guessing you use an extension in Sphinx to support Markdown. If so, which one? Does it support variable substitutions like |release|, |version|?

from emojicodes.

casperdcl avatar casperdcl commented on June 13, 2024

In markdown, you can use eval-rst:

```{eval-rst}
|:white_check_mark:| hacky
```

to get:

✅ hacky

from emojicodes.

casperdcl avatar casperdcl commented on June 13, 2024

Yes and I suppose the .md syntax would be [:smile:] or [](:smile:)

from emojicodes.

jdillard avatar jdillard commented on June 13, 2024

myst-parser automatically adds .md to source_suffx: https://github.com/executablebooks/MyST-Parser/blob/ebf989fdae10c68dfbd3dcdfec4b86259b810cd9/myst_parser/sphinx_ext/main.py#L34

The problem isn't the syntax to be parsed, its the suffix (extension) of the files to be parsed.

from emojicodes.

casperdcl avatar casperdcl commented on June 13, 2024

yes I know, I was just commenting on what the future PR should probably support in terms of UX (in response to this) :)

from emojicodes.

dannybeckett avatar dannybeckett commented on June 13, 2024

@Peque @casperdcl @jdillard

I am interested in trying to completely swap rst for md (I have no .rst files, only .md files).

I tried this:

apt-get update && apt-get install git -y
git clone https://github.com/sphinx-contrib/emojicodes.git ../emojicodes
sed -i "s/rst/md/" ../emojicodes/sphinxemoji/sphinxemoji.py
cat ../emojicodes/sphinxemoji/sphinxemoji.py
pip install build
python -m build ../emojicodes
pip install ../emojicodes/dist/*.whl

It successfully replaces rst with md + loads the extension in to Sphinx, but unfortunately still doesn't want to display emojis.

I am using the myst_parser extension to parse Markdown, which supports substitution.

In conf.py I have myst_enable_extensions = ['substitution']

In the .md file I have tried:

:white_check_mark:
[:white_check_mark:]
|:white_check_mark:|
{{:white_check_mark:}}
{{white_check_mark}}
{{"a" + "b"}}
```{eval-rst}
|:white_check_mark:|
```

Myst uses {{ .. }} as delimiters, but the delimiter is configurable.

The ones inside {{ .. }} in my list/code block above are replaced with blank strings, except "a" + "b" which successfully replaces to ab. The {eval-rst} still continues to show the emoji unexpectedly though.

Usually Myst expects you to feed it a list of substitutions in the conf.py or in the .md file.

Any help is much appreciated please!

See also: Stack Overflow question

Many thanks

from emojicodes.

Peque avatar Peque commented on June 13, 2024

@dannybeckett I haven't had the time to look at this, but I'd be happy to review and integrate a PR if someone is able to implement it. 😊

from emojicodes.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.